#help-with-audio
1 messages · Page 3 of 1
You could record silence and see what the bias seems to be in that case, and assume that is constant and subtract it. But I'm not sure about that.
okey nice idea thank you
i will try and if i can do it in circuit python i will make a guide
to share
like, record silence, and then also record a constant signal, like a 1khz tone, and see if the bias is at the same place
Sorry if now is a bad time to ping you, but I just checked the voltage on both VU meters on the reel to reel, and neither of them are getting power.
The current would be DC, right?
Normally the voltage to VU meters will be very low (the meters themselves are actually current driven, and have a low resistance)
How low? I managed to detect about 0.04 or 0.004 volts but that might just be some static or maybe my meter touched something else.
if you had an oscilloscope, you could check what even a low-level signal looks like. It would not be a constant voltage. Are the meters still not moving at all? You could see if you could carefully unsnap the cover and see whether the needles are stuck or not. Or if you tap on the cover, or reorient the tape deck, or move it side to side or rotate it a bit to see if they move at all.
I tested the current too but got nothing
Yeah I tried to unstick the needles last night, but they didn't seem to be stuck.
I suspect it's a problem with the circuit that drives the meters
Some meters will have the full scale current marked on them, it's often 1mA or even less.
I don't think this one is marked
So I spent hours following the instruction booklet on calibrating the VU meters, and I got the TK1 meter to work with a D cell battery and a 4.7k resistor. The TK2 meter seems to be broken? The coil might have come unspooled because there's thin wire all over the inside of the meter.
oh that's terrible, about the coil. I wonder how that happened. ... I think I saw some descriptions of replacements for meters for this tape deck while doing my initial websearches, but not sure if they were identical replacements (maybe they were square or rectangular).
There are two "coils" in the meter, the deflection/galvanometer coil that the current to be measured flows through, and a spiral spring that provides the restoring force. Either of these can come loose.
I could look through the parts list to see if there's a part number I could look up but I might just have to leave it as is.
Is there anything I can replace to reduce the hiss a little more? Maybe replacing some of the tubes? I don't know much about tubes but I looked one of them up and they're pretty expensive.
The tubes are not the most likely source, unless there are grid pentodes in the audio path. More likely suspects are noisy resistors and the tape itself. You can also roll off the high frequencies, which will reduce hiss, and there's likely not much high frequency audio to start with since it's tape.
Would it be worth it to replace the resistors?
Start with caps. Anything electrolytic or paper should be replaced.
Ok, I lost my capacitor replacement kit so hopefully I can find some matching ones in my stash of random caps
Note that tube circuits run at higher voltages than most solid state, so many capacitor kits won't contain capacitors of sufficient voltage.
However, I doubt that capacitors are contributing much to the hiss. However, old electrolytic and paper capacitors do fail, which can cause other problems.
I'm not seeing many paper capacitors, which are unpolarized right? I'm mostly seeing polarized ones
Paper caps are old. You'll see them in pre-'60s equipment.
They might. Hard to say.
I looked up a capacitor with the equivalent value and they're much larger than that.
The old abbreviation for microfarad is mmfd (milli-milli-farad)
Yeah it's probably uF then.
The old schematics I've seen use "mf" for "microfarad" (not millifarad), and mmf for "micro-microfarad" (that is, picofarads). I'd agree that electrolytic is probably 5µF
So I found a few capacitors that could be replaced on the tape deck, but there were some with odd values that aren't really manufactured anymore. So I found some that were of similar values that are hopefully compatible. Would these ones be okay to use as replacements?
300uf 3v -> 300uf 50v
100uf 12v -> 100uf 16v
40uf 10v -> 47uf 10v
25uf 6v -> 27uf 16v
I guess it really just depends on the purpose the capacitor serves, but I tried to prioritize keeping the capacity the same while making sure the voltage rating is the same (if possible) or higher.
For the first one (I'm guessing it's an electrolytic, you may not want to use a 50V one in a 3V application, as the difference in voltage is enough to possibly cause a change in characteristics. I'd probably replace that one with a 330µF 6.3V unit.
First, check the tolerances. Those old caps are probably ±20% at best. Second, try to figure out whether they are in the signal path. If they're just bulk decoupling caps the exact ratings probably don't matter that much.
Note that modern capacitors can be considerably smaller than vintage ones. The little green one on the right replaced a much larger original.
At the same time, you have to be somewhat careful. The maximum voltages on modern caps are not something you can fudge. Transients can absolutely cause them to explode.
Especially with tantalums.
I accidentally reversed the position on a 100uF 6.3V tantalum and it shot a fire ball at me when I applied power lol
And I only applied ~5V to the rail 😬
Yeah, and overshoot on the power rails wasn't nearly as big of a concern in old equipment.
A tube circuit designed for 180V would generally work okay on 225V.
Ok I swapped that one out. The 300uf one I found on digikey was rather expensive too so I'm glad I can get rid of that one lol.
How can I identify the wattage of a speaker. It measures just shy of 8ohms, and is run inside a toy from 2x AA
I use a lot of these similar looking speakers often found in toys. Mine are all 1/4 watt. Yours looks like it might be physically a little larger.
Hi everyone.
I've recently acquired a Electret Microphone Amplifier - MAX9814 with Auto Gain Control (https://www.adafruit.com/product/1713) and I want to use it so as to measure sound levels of frequencies as high as 20kHz (which should be supported by the mic specs). I thought that I could accomplish that by adapting Adafruit's guide on this topics (https://learn.adafruit.com/adafruit-microphone-amplifier-breakout/measuring-sound-levels). The guide is setup so as to measure sound levels of frequencies as low as 20 Hz (via a sample window of 50 milliseconds), but it is unclear to me how I could change it so as to measure at the range I'm interested in. I wonder if anyone would have tips on how I could do it? Thanks!
The limiting factor for high frequencies isn't the sample window, but how fast the collection loop runs (which in turn may be largely limited by the speed of the analog to digital converter)
Looking to transmit I2S data to a 1/4 inch mono jack that will go to an amplifier. This breakout https://www.adafruit.com/product/3006 and the MAX98357A onboard is perfect capabilities-wise except for the fact that it's supposed to power speakers directly.
What kind of options would everyone suggest given my constraints? Or is there a way to set this particular chip up to run to an amplifier (e.g. a guitar amplifier or PA) properly?
There is a part for that, but the AdaFruit offering for it is for a Pi, so you might have to figure out the wiring to hook it to something else https://www.adafruit.com/product/4037
There had been a plain version, but it's discontinued https://www.adafruit.com/product/3678
Yeah, I've seen the obsolete version. What I'm looking to do is make my own board eventually and the UDA1334 chip itself appears to also be obsolete. It would be nice if there was a breakout a la Adafruit's offering, but it's not a strict requirement.
At that point, I start looking at vendors to see what chips are currently on offer https://www.mouser.com/c/semiconductors/audio-ics/audio-d-a-converter-ics/?interface type=I2S
don't use that chip for anything other than direct speaker connection. It uses some effect of the speaker (inductance? the coil? capacitance of the speaker? how the speaker is basically dampened by the air resistance? I forgot it) to basically filter the audio signal. If you hook up an amplifier to it, you get terrible noise afaik.
there are different I2S DACs on like aliexpress and such that have different kinds of output including line out.
Maybe "pirate audio" or "hifiberry" could also offer some options that you could use. They're made for raspberry pi but I think it's just I2S after all. 🤔
But please double-check which "flavour" of I2S that chip needs, and whether your microcontroller can actually support that exact flavour.
If you're worried about loudness. That MAX9814, powered by 5V, with a 6cm diameter 4 Ohm speaker at default 9dB gain is too loud for me! And I could even increase the gain. But of course, that's not a guitar amp or PA
I'm not worried about loudness per se. Mostly trying to make sure whatever I use won't end up damaging other equipment.
I am a fan of the cheapie PCM5102A I2S DAC modules https://todbot.com/blog/2023/05/16/cheap-stereo-line-out-i2s-dac-for-circuitpython-arduino-synths/
Thanks! Funny, per a suggestion I was just looking at what appears to be a Pimoroni board using this or a related chip: https://shop.pimoroni.com/products/pico-audio-pack?variant=32369490853971
So I guess that chip in one format or another is a good one to check out!
I hope that is not rude to post non-Adafruit boards here.
I have the Pimoroni Pico DV Demo Base that also has the PCM5100A on it and it's great. I just discovered that Audio Pack board yesterday and have a few coming to try out myself
Wow, the Demo Base looks pretty cool too. Ordered up a few of the I2S DAC modules you suggested, looking forward to doing some experimentation!
inline int16_t Amplify(int16_t s) {
int32_t v = (s * gainF2P6)>>6;
if (v < -32767) return -32767;
else if (v > 32767) return 32767;
else return (int16_t)(v&0xffff);
}
gainF2P6 is uint8_t and 2.6 bits fixed point.
https://github.com/earlephilhower/ESP8266Audio/blob/0abcf71012f6128d52a6bcd155ed1404d6cc6dcd/src/AudioOutput.h#L67
Only talking about the last return. Just posting the entire thing for context.
what's the point of the bitmasking (v&0xffff)here? Is that actually required or just good style?
I just tested it and casting from int32_t or uint32_t to int16_t or uint16_t always produces the same result, no matter with or without the bitmask
# s8, peak near 0, equal weight into -128 and +128 ranges
# u8. peak near 127, equal weight on both sides
ffmpeg -i input.mp3 -ar 16000 -ac 1 -f u16le -acodec pcm_u16le output.raw
some notes, from what i was doing audio on my pi
if you tell ffmpeg to produce signed 8bit audio, and you interpret it as signed in your code, then its centered on 0, and goes positive/negative
but if you tell it to produce unsigned audio, and treat it as unsigned, its centered on 127 (half of int8_max), and goes up/down from there
I'm working with some audio library that uses int16_t and clips it to go from -32767 to 32767
thats just signed 16bit ints
huh interesting
yes, but int16 could go one lower 😄
ah, so they added their own limits
to make it perfectly symmetrical I think
in my case, i converted a youtube video into a raw audio, and then usd .incbin to embed it into my compiled binary
and then i just told c it was an uint16_t[]
https://github.com/pschatzmann/arduino-audio-tools/wiki/MemoryStream:-Converting-a-File-to-Flash-Memory for testing I used a file that was created like this
but in the end I want to play wav or hopefully mp3 from SD
e.g. with "xxd -i file_example_WAV_1MG.raw file_example_WAV_1MG.c"
this ugly mess, is what .incbin solves
i find it silly that you have to convert binary to hex, then have the compiler turn hex back into binary
[nix-shell:~/apps/rpi/lk-overlay]$ cat dev/audio/wear.S
.section .rodata
.global wear
wear:
.incbin "dev/audio/wear.bin"
.global wear_end
wear_end:
and this just embeds a binary directly into .rodata without any conversions
gcc also recently gained an extension, to do that without assembly
but i forget the name of the flag
https://github.com/librerpi/lk-overlay/blob/master/platform/bcm28xx/arm/payload.S
.section .rodata
bcm2835_payload_start:
.incbin "../../../build-rpi1-test/lk.bin"
bcm2835_payload_end:
...
.data
DATA(arm_payload_array)
arm_payload_array:
# bcm2835 pi0/pi1
.int bcm2835_payload_start
.int bcm2835_payload_end - bcm2835_payload_start
# bcm2836 pi2
.int bcm2836_payload_start
.int bcm2836_payload_end - bcm2836_payload_start
# bcm2837 pi2 rev1.2 and pi3 in 64bit mode
.int bcm2837_payload_start
.int bcm2837_payload_end - bcm2837_payload_start
END_DATA(arm_payload_array)```
@young pawn with this, i can embed 3 binaries, and create some intermediate start/end symbols
then i can generate an array of start/length ints
https://github.com/librerpi/lk-overlay/blob/master/platform/bcm28xx/arm/arm.c
typedef struct {
uint8_t *payload_addr;
uint32_t payload_size;
} arm_payload;
extern const arm_payload arm_payload_array[3];
and then on the C side, i just claim its an array defined externally
and boom, all of the pointers and lengths are pre-filled
neat, I didn't know other ways than xxd 😄
there is also the objcopy route
but kinda of course there are dozens of ways to do anything 😆
$(OBJCOPY) -I binary -O elf32-vc4 -B vc4 $< $@
extern uint8_t _binary_arm_chainloader_build_arm_chainloader_bin_start;
extern uint8_t _binary_arm_chainloader_build_arm_chainloader_bin_end;
but that creates an ugly pair of symbols, based on the filename and path
while .incbin lets you hide all of that ugly with non-global symbols in the .S file
I just wanted to thank @weary gyro for his amazing tips page on synthio. I’ve got a drum sequencer on a Pygamer partly working.
Ignore the children in the background.
I found some beauties when playing with audio, free-loops.com and https://sound-effects.bbcrewind.co.uk/search (only for non commercial use)
That's very awesome! Looks like some @rare torrent synthdrums in there too!
Yup. I borrowed those. 😉
I’ve started building a grid to set each step. More to come in the next couple of days
can download em fine from canada dfoesnt seem like uk vpn needed. If that helps someone
Is this normal?
I have a .mp3 with 32bps. When I listen to it, it sounds great.
But when I convert it to 32bps wav there is cracking. I think it's only in loud parts. I've encountered this with 4 songs/files now
Converted to 16bps wav, it's fine again.
I use audacity to convert it. (just load the file, and export it again. No editing or anything else). And I'm listening with VLC and bluetooth headphones that only support 16bps and screen speakers that support 24&16bps. What's going on?
The main issue is:
I would like to have the same song (with zero cracking) as wav with 32, 24, 16bps and ideally each at different sample rates as well
converting to mp3 loses information, and 32kbps is a pretty low data rate for MP3. When you play an MP3, it has to get converted to wav in order to play. The converter doing that has some settings, but I'm not sure how to find that out. Maybe the player is converting to 16kbps and that's why it sounds fine.
If you import the mp3 into audacity, does it play fine?
sorry, I don't mean kilobits per second, but bits per sample
in audacity the mp3 plays fine
I don't think bps is meaningful for an MP3. Did you encode the MP3 yourself? What were the encoder settings?
bits per second is the important thing for the wav files because I want to test some audio code I wrote 😄
good point. looks pretty clippy to me. (That's the mp3)
ugh 🙂
i don't know why the Audacity playback doesn't sound worse, but I assume it's due to the conversions going on to play vs write a .wav
yeah, I guess there's something weird going on with that. Thank you 😄
progress on the drum sequencer:
q: How can I play notes in the background with synthio? I want the UI to still function while notes are playing. Do I need to use await or just loops instead of sleeps?
no need for asyncio. sleeps could cause problems
another side-project ive been doing on the rpi, is audio via the PWM hw
in its current configuration, its doing 1 PWM pulse per sample, so my PWM rate is ~44khz, and the top waveform is after the hw lowpass filter
it looks rather ugly, and i'm wondering is doing 2 or 3 pulses per sample might smooth it out?
@echo hedge what do you think?
I think we run the PWM outside of audio frequency range and then just change the duty cycle at the sample rate
(look at circuitpython's audiopwmio)
the tricky bit here, is that the rpi PWM has a fifo
you feed it a list of duty cycles, and it will emit one pulse per entry
so you dont have to update the duty-cycle at 44khz, you just dma a stream of duty-cycles to it
but now, the pwm rate, must be a integer multiple of the sample rate
i'll try double, and see what that does
what kind of hardware filter are you using?
the existing filter on the rpi
this is its schematic from the pi1b
and this is the same filter from the pi4b
I built it for the PyGamer but it should work on any board that supports synthio.
Currently it has three voices for drums.
Next I want to add an editor to add more voices.
Hello!
I'm not sure where to begin with describing what's going on but when I play an mp3 (audiomixer and i2s), it begins with a sharp pop or scratch sound and then I get follow up ones at random intervals after that. The mp3 in question comes from this guide (https://learn.adafruit.com/led-rocket-lamp#about-the-enceladus-hiss-mp3-file-3136744) but I am seeing the same behavior from other mp3s (such as the ones from John Park's walkmp3rson guide). Interestingly, this does not occur if I play a wav file, even converting the above mp3 to a wav. If it helps, I'm using a RP2040 Propmaker Feather with the 8 Ohm 1 Watt Mini Oval Speaker!
MP3 decoding is very CPU intensive, I'm kind of surprised it works at all. Any other things happening in CircuitPyton (your editor accessing the CIRCUITPY drive, your code reading I2C devices, etc) can cause audio dropouts.
However, you can sometimes get these dropouts to go away by increasing the buffer_size in the audiomixer.Mixer(). It defaults to 1024 but I have good luck with 4096. E.g. if your code looks like this:
mixer = audiomixer.Mixer(voice_count=1, sample_rate=22050, channel_count=1, bits_per_sample=16, samples_signed=True)
change it to look like:
mixer = audiomixer.Mixer(voice_count=1, sample_rate=22050, channel_count=1, bits_per_sample=16, samples_signed=True, buffer_size=4096)
Thanks, @weary gyro! I'll give that a shot.
Question about synthio examples. I tried TodBots code to create a saw wave and it works fine, but the sine wave does not. I’m not sure if the calculations are wrong or if it’s just a whole lot quieter
sine waves are perceptually a lot quieter than square or saw waves. not to say there couldn't be math problems too 🙂
Ah. That makes sense. I’m listening with the little built in speaker. I’ll try with headphones and report back.
also one of the "nice" things about signals with lots of harmonics like square and sawtooth waves is they introduce various kinds of distortion that make the signals easier to hear on tiny speakers
@weary gyro do you have any ideas about this question from a few days ago?
I don't think I have much to add. I don't do much at that low-level any more. It's not clear to me what your expected output should be. If the bottom trace is expected output and top trace is PWM-filtered output, then looks like your RC filter is too big and you need to lower its time constant (reduce its R or C). As for general approach of using PWM-pulsewidth-per-sample, that is the technique I am most familiar with from most PWM DAC techniques. Many libraries just take the sample and scale it to use directly as PWM duty-cycle. You said you're doing this on the Raspberry Pi, there are many working examples of using two PWM pins to give you stereo out for use by ALSA or whatever by adding a device-tree overlay. I think it's even built into raspi-config now? I have vague recollections of seeing it there
raspi-config doesnt really apply here
because ive replaced the official firmware
i cant change the RC filter, because i want it to work with normal boards
so i need to adjust my PWM freq, to match the existing RC filter?
this is what the official firmware does:
Stage 1 is source samplerate conversion (8kHz-48kHz -> 48828Hz) - this fractional conversion is required as the PWM source clock is not a power-of-two product of audio sample frequencies.
Stage 2 - Oversampling by factor x8 to 390625Hz using a length=512 FIR filter with a nice, sharp cut-off.
Stage 3 - A final x2 oversampling stage with a length=4 FIR filter, which is folded into the noise shaping for various beneficial reasons.
Stage 4 - 2nd-order quantisation noise shaping from 16-bit PCM at 781250Hz to 7-bit PWM samples.
so, i think its using a 781khz pwm rate, with 7bit samples
and then using dithering to simulate 16bit samples
Ah, bare metal on RasPi. Sounds like you're beyond my abilities then
i guess what i should do next, is just try some things like 200khz, 300khz ... 700khz, with a constant duty cycle
and see when the RC-filtered looks good, and the audible noise goes away
> (781250 * Math.pow(2,7)) / 1000 / 1000
100
oh, and that sample rate, suddenly makes a lot more sense
its just a 100mhz ref-clk
each sample, is then 2^7 clock cycles long
and the duty cycle, is then just a 7bit number
Is it possible to create delays and reverb with synthio?
Cheap stereo line out I2S DAC for Circui...
Would I be able to use a Stereo 3.7W Class D Audio Amplifier with speakers and a knob with the Grand Central M4 with 5v power?
I think that would work fine. Are you thinking of using the onboard DACs to generate signals? You may need a little interface circuitry, but nothing complicated.
Maybe? @glacial spruce I'm new to all this and I was using the tutorial for the grand Central as a sound board and wanted a better way to make it portable without having to work about the jumper wires disconnecting.
Any guidance would be appreciated.
I saw someone In the forums recommend a mono amplifier and use two mono speakers.
I probably have to use the mono speaker instead of 3w 4ohm one?
Basically, whether you want to do mono or stereo is up to you: the SAMD51 (and therefore the Grand Central) has two DACs, so you can have individual signals if you want. You can use a stereo amp (with either a mono or stereo input) and two speakers.
I'm not sure what you mean by "mono speaker", pretty much all speakers are mono, you just use two of 'em for stereo.
ah that makes more sense. The wording was confusing me so it didn't really click. Thank you!
would adding a 10K Log Potentiometer mess up the signals?
No, that's how a traditional volume control works
Awesome. Thank you!
Hey guys! I have a soundboard (https://www.adafruit.com/product/2210) and a speaker (https://www.adafruit.com/product/1314) and I don't know how to tell if the sound I'm getting is as loud as it can go or if there is a way for me to make it louder
Would you like to add audio/sound effects to your next project, without an Arduino+Shield? Or maybe you don't even know how to use microcontrollers, you just want to make a sound play ...
I would also like to toggle a sound when the soundboard and linked ItsyBitsy (https://www.adafruit.com/product/3800) both get powered up
What's smaller than a Feather but larger than a Trinket? It's an Adafruit ItsyBitsy M4 Express featuring the Microchip ATSAMD51! Small, powerful, with a ultra fast ATSAMD51 Cortex ...
Okay, so the speakers can handle a little more power than that sound board is set to put out.
And it's got 2 channels, so you could use 2 speakers for more power.
Okay, so I think my earlier suggestion was to just use it in GPIO trigger mode.
Yeah, so there's the Vol + and Vol - pins. That would be what you'd use to control the volume if you are in GPIO trigger mode, which is the easier of the potential modes to get going.,
Yeah, so the way I was thinking you'd want it to work is to set it up such that you run a GPIO pin on the ItsyBitsy M4 to one of the trigger pins on the sound board.
But then you'd also want to hook up the Vol+ and Vol - pins to buttons so you can turn up the volume.
Ugh, I hate saying use the serial port to control it because that's more coding and stuff.
Would adjusting the volume stick? Or would I have to readjust it every time the board gets power?
The second, according to the tutorial page. Not the end of the world to leave it powered up
Probably easiest way forward, because cosplay project, is to get the volume pins working and do it via the GPIO trigger mode and if you have time you can go back and switch it over to the serial mode if you still have time.
Is it possible to stream audio (WAV) over good WiFi to an esp32s2 +audio bff. Like shoutcast/icecast back in the day (aware still exists).
I've seen an example for that in the Arduino-Audio-Tools library
(but tbh I'm not sure if it works with ESP32s2 specifically. I have no idea what the differences are between all the ESP32)
S2 single core, no BT/ble, otherwise similar to S3. Both have native usb, but original esp32 didn't (dual core still with BT/WiFi)
IIRC from just reading random stuff in that audio library, there are some ESP32 (or some specific boards) that don't have I2S (or have it not accessible or have it not yet software supported or something like that).
I know, sorry, I'm really vague here. :/
That makes sense. I believe the S's do have i2s, but can't remember the original esp32. Maybe the c3 is missing it, and probably the esp8266 too. Not sure on the H series but probably got it as more powerful than C series.
There was something in the back of my mind about one of the S series regarding DMA access and I2S lacking software support in certain languages / toolchains but hardware existed.
I can vouch that the esp32-c3 does have I2S - I’m using it with an adafruit 512MB flash chip and MAX98357 I2S amp which is great because esp32-c3 doesn’t have a DAC unlike the ESP32.
ooooo 🙂 also didn't realise adafruit did large flash chips, thank you very much!
And @tepid grove All ESP32's have I2S. You can use the I/O mux to map the I2S pins to any available I/O pins, so it doesn't matter if a board specifically expresses them. The original ESP32 and the S3 have two I2S controllers; the S2, C3, C6 and H2 all have one.
(I have notes where I keep track of all this 😉 )
The I2S breakout 3006 appears to have an RC filter on each leg - are these values enough to knock the 300KHz edges off for line-out to an audio interface, or do I need to put something else inline?
also, any advice for volume control with this chip from a Pico running synthio?
Thank you 😄 Then I must have mixed that up with something else
any chance those wonderful notes are on github 😉
There are too many versions! 🙂
That's a great idea. Right now they're embedded in drafts of articles that I never get around to finishing, but I'm happy to share them. I'll think about a good structure for doing that on Github.
Generally on I2S amps, you set the hardware gain to a fixed level and then adjust your content's volume. For synthio, if you run the synth through AudioMixer then you can adjust its volume level with the mixer.. e.g. something like this:
audio = audiobusio.I2SOut(...)
mixer = audiomixer.AudioMixer(voice_count=5, channel_count=1, sample_rate=22050)
audio.play(mixer)
synth = synthio.Synthesizer(sample_rate=22050)
mixer.voice[0].play(synth)
mixer.voice[0].level = 0.25
For a more complete example, you can check out one of these: https://github.com/todbot/circuitpython-synthio-tricks/tree/main/examples
That is indeed generally true, as it's the easiest and requires the fewest parts. However, it's not the highest fidelity approach, which is generally to keep high signal levels until the final attenuator/amplifier. In most cases, you don't need to go to all that trouble (and again, most people don't). But if you're aiming for maximum fidelity (and if you're already doing all the other complicated and expensive things required to achieve that), it may be worth considering fancy things like motorized potentiometers at the final stage to adjust volume.
I'm less concerned about maximum fidelity as this is a novelty at this point, but I'd like to be able to control volume dynamically. It sounds like AudioMixer can do it, although it's probably overkill.
More detail: I'm making a synth accordion. I'm looking for something I can use to emulate the function of the bellows. My first thought was to point each of the synth Notes at an amplitude variable and update this amplitude each time I read the "bellows" input.
ah well if you're using synthio, then each synthio.Note object has an amplitude property you can dynamically set. you could do something like:
note = synth.Note( frequency=440, waveform=..., ...)
synth.press(note)
# some time later
note.amplitude = 0.3
# even later
synth.release(note)
The other benefit that AudioMixer gives you is the ability to specify a buffer_size, which can help with glitches if you have other I/O devices (particularly I2C devices)
Is it possible to map multiple notes' amplitude to a single variable that can be changed to affect all notes at once?
yes but it can get a little complicated. for global volume your best bet is probably to use the audiomixer. if you did want per-note volumes but also global volume sometimes, one approach would be to iterate on them:
notes = [] # list of Notes that are playing (you save them as you 'press' them)
def set_notes_volume(volume):
for note in notes:
note.amplitude = volume
set_notes_volume(0.45)
set_notes_volume(0.90) # and so on
I've been thinking about this the past few days. It seems like delays and reverb could be created with a ring buffer that mixes the latest sample with and old one from the buffer, then writes the new value back to the buffer. But then I realized that the cost here is memory, not computation. A couple of seconds of echo would be a lot of memory at 44khz
New synth tests.
I’m especially happy with the blade runner instrument. Thanks to @weary gyro for his tutorial on modifying a filter in real time.
that's awesome!
I mixed 20% noise with the saw waveform to create noisy saw. However I had to do it sample by sample. LERPing the entire arrays printed a data type error.
noisewave = np.array([random.randint(-32767, 32767) for i in range(SAMPLE_SIZE)], dtype=np.int16)
plain_saw = np.linspace(-SAMPLE_VOLUME, SAMPLE_VOLUME, num=SAMPLE_SIZE, dtype=np.int16)
noisy_saw = lerp(noisewave,plain_saw,0.9)
the code executes, but when I try to use the weavform it says: ValueError: waveform must be array of type 'h'
hmm. that code chunk works for me.
oh, are you getting the error when attempting to assign to note.waveform?
You need to either re-cast that array as np.int16 or (what I do), do the full-array-size replace, e.g.
noisewave = np.array([random.randint(-32767, 32767) for i in range(SAMPLE_SIZE)], dtype=np.int16)
plain_saw = np.linspace(-SAMPLE_VOLUME, SAMPLE_VOLUME, num=SAMPLE_SIZE, dtype=np.int16)
noisy_saw = lerp(noisewave,plain_saw,0.9)
wave_empty = np.zeros(SAMPLE_SIZE, dtype=np.int16) # empty buffer we'll copy into
note = synthio.Note( frequency=220, waveform=wave_empty)
note.waveform[:] = noisy_saw
ah, okay. that's an interesting trick.
it works now with this code: ```noisewave = np.array([random.randint(-32767, 32767) for i in range(SAMPLE_SIZE)], dtype=np.int16)
plain_saw = np.linspace(-SAMPLE_VOLUME, SAMPLE_VOLUME, num=SAMPLE_SIZE, dtype=np.int16)
noisy_saw = np.zeros(SAMPLE_SIZE, dtype=np.int16)
noisy_saw[:] = lerp(noisewave,plain_saw,1.0)
excellent. if your goal is to keep around "noisy_saw" and not just immediately assign it to note.waveform then you could cast the output of lerp() to an int16 array like:
noisy_saw = np.array( lerp(noisewave,plain_saw,0.9), dtype=np.int16 )
I'm wondering if there are ways to test sound for more than pitch and volume and ways to reproduce sound involving more than just playing back a waveform or a midi type of synth the end point of being able to use a txt to speech through some controllable electronics to make it sound like a saxophone talking or a violin "talking" rather than sound like a person with a pitch shifted human voice I have a cheap Midi Keyboard and the sound it produces basically the same sound reguardless of what instrument is chosen I can kinda play a couple of different instruments and have in interest in making some midi controller/synth combo - digital instruments like some ive seen on you tube and a few other sites If there is a number of paid to access midi voice files but finding free or low cost voices that work with different types of hardware / midi software on windoze are there low cost hobiest midi instrument voice making software for use in win or on a Pi
do some websearching on "talkbox", "vocoder", and "voice to isntrument". You'll find a lot of stuff, some free. Mostly these are plugins for "digital audio workstation" software,
Question: https://www.adafruit.com/product/3885
Does that have a DC filter capacitor? Do I need one if the audio is coming from a QT Py RP2040, via the synth module, using PWM?
Also, does that have any kind of filtering at all, or do I need to add a low pass filter between the microcontroller and the speaker, to remove PWM switching noise? (Yeah, I know that technically the voice coils can filter the PWM noise, but I'm not sure if that applies to this particular speaker or whether it still might be a good idea.)
Hey, have you heard the good news? With Adafruit STEMMA boards you can easily and safely plug sensors and devices together, like this Adafruit STEMMA Speaker - Plug and Play Audio Amplifier. ...
From the schematic in the Learn Guide for it https://learn.adafruit.com/adafruit-stemma-speaker/downloads, it looks like it does have a pair of 1uF DC blocking cap but no PWM RC filter. The PWM rate of CircuitPython's PWM is high enough and the response of that speaker is low enough, that I think I think it will work.
But be aware, even with the best filtering to that little amp it's going to sound relatively cruddy. That little speaker is just too small to make very impressive sound. It's great for simple beeps and bloops
Filtering after the amp (with the speaker) means the amp can create "intermodulation distortion" from the two signals
I should have realized there would be some kind of DC filtering between the microcontroller and the speaker. The amp chip would almost certainly be high impedance on the input, which would block DC even without a filter cap.
Good point on intermodulation. So the takeaway is, I don't need DC filtering, but I should probably filter the PWM if I want a small quality improvement. I actually have the speaker, and I've tested it out a bit. The sound quality isn't awesome, but I didn't expect it to be with both a low end speaker and a low end amp. I was just kind of fishing to see if I could clean it up a little bit, and it sounds like filtering the PWM will work.
Thanks both of you. I really appreciate it!
High impedance won't "block" DC, it just won't draw any appreciable current.
Right, but in terms of audio, that's all that is important. Normally, you don't even worry about DC except between the power amp and the speaker, because the speaker is the only thing that could sink enough DC power to be a problem. (Technically speaking, a DC filter capacitor is the same. It doesn't actually block DC, because there's no such thing as a capacitor that doesn't leak.)
i might also worry about dc between an analog source, and an ADC
since the bias means it will clip sooner in one direction
In this case the source is digital (but PWM, so sort of analog but constrained to the chip supply voltage) and the receiving amp is analog, so that won't matter here, but yeah, even an analog source to an analog sink could end up clipping sooner in one direction with a DC bias (but the effect with an ADC would be more pronounced...). Hmm, that does mean that if I set the gain of the amp too high, I could still end up clipping in one direction sooner than the other...
This is definitely something worth keeping in mind. I probably would want a DC filter cap if there was any chance of saturating the amp, if there wasn't already one.
@weary gyro Sorry to bother you - Where did you have your PCBs made for the QT PY Synth? I'm very tempted to send an order in.
From JLC PCB. I just put an order in for a bunch to put in my Tindie.
I'll send you one
I can wait till they're on Tindie, you've been more than generous. 🙂
🙂
I assume you soldered in the TRRS jacks and rotary encoders?
Yes. The jacks are SMD and will come pre-soldered, along with the entire audio out circuitry and TRS MIDI input circuitry
Perfect, I think I actually may have all the parts already!
nice. Also, that "wavetable_midisynth" one I just made a video about on youtube has a "code_i2s.py" version that works on a Pico & PCM5102 that you have. And if you set its auto_play=True it will play a little song without needing MIDI
cool! thanks for the heads up
I've got a db Technologies FM10 powered speaker that recently made a small pop when turned on and now has no audio, though the power light works. I've opened it up and discovered that the NXP TDA8950TH amplifier IC has left a skid mark on the board and also cracked open a ceramic capacitor next to it.
The amplifier IC isn't made anymore, though there are some available from AliExpress. What are the chances of the Ali part being genuine, or if it isn't is it likely to work anyway? Parts that are pin compatible don't seem to be any more available, as far as I've found so far.
It's one of those "it may be worth a try" situations. It could be there are other circuit faults that killed off the first IC, and will just kill off the replacement. Or a chip (and capacitor) swap may bring it back to life. If not, you can always just stuff a different amplifier board in it.
for context, ive been working on the open rpi firmware, and one of the goals is getting analog audio working
this would be the spectrum plot for a test file that i was playing, just the original input file
this would be the result of playing that file on an rpi, with the stock firmware
running the analog audio into an old JVC sound bar
then recording it on my cellphone
to my untrained ear, it sounds fine, but you can see some distortion in the graph
and this would be my entirely custom audio driver, on the exact same hardware
it has distortion that i can easily hear
any tips on what i could try to improve it further?
ive been pointed to delta-sigma in other channels, but cant make sense of the pdf i was sent
no idea if this is helpful, but here is an implementation of delta-sigma audio output on ESP8266 https://github.com/earlephilhower/ESP8266Audio/blob/master/src/AudioOutputI2SNoDAC.cpp#L78
lets see, first you avg together 2 samples
oh, that reminds me
due to the rather low pwm rate, there is a very strong 48khz tone in the output
and to avoid that, i was just playing every sample twice, as-is
but i now realize, thats a rather dumb form of over-sampling, and just averaging may help
writes more code
i also just realized, i'm not dealing with LR interleaving right, when i do that
helps to get a good night sleep and then take another look at the code
so first, as i loop thru the audio samples, i put them into next_right and next_left
once ive gotten a pair, i average with last_left and last_right, and write those to the output buffer
then i write next_left and next_right, and update last, that should be right, and slightly better...
but its generating too many samples, something wrong with the logic i didnt mention....
and ive somehow horribly broken it
i think the problem, was how i was doing bounds checking and wrapping in the write buffer
i was using == to wrap, and only checking once per loop
but the code to deal with interleaving, and over-sampling, wrote 4 in a loop, then nothing for a few passes
so it stepped over the trigger, and didnt wrap right
the sample rate is correct now, but just a dumb avg of last&next sample seems to have made it sound worse
heh, surprisingly, you can still make out the vocals at 2bits/sample!
instruments are just destroyed though
i seem to remember hearing something about bit depth being related to the noise floor
hmmm, and what effect might the MASH filter and fractional division have....
ref: 432000000, target: 24576000, divisor(f): 17.578125, divisor(fixed): 0x11940
> 432000000/17/1000/1000
25.41176470588235
> 432000000/18/1000/1000
24
so, if it lacked mash, it would just be randomly alternating between 24mhz and 25.4mhz
and each pwm period is 128 clocks long
assuming worst case, the pwm period would vary from 187 to 198khz
it seems to sound best with no over-sampling, if i stick to the dumb repeat a sample N times method
and the avg between 2 samples method can only 2x, and makes it sound worse as well
i'll need to study things more
Could someone explain to be what the RING parameters of synthio do?
It's to do ring modulation. essentially synthio multiplies a Note's ring_waveform and waveform together. The result is usually not very musical (as the resulting harmonics aren't related musically to the original waveform pitch) but can be useful for making bell / robot /scifi sounds.
some useful links: https://synthesizeracademy.com/ring-modulator/
https://www.perfectcircuit.com/signal/ring-modulators
Okay audio heads, does this idea make any sense at all... It's basically a virtual theramin. Using a grid time-of-flight sensor (VL53L5CX), and imagining a vertical "aerial", and using the proximity to center in the horizontal plane as pitch like normal, and the Z or vertical plane as volume. I initally invisaged the right hand side for pitch and volume and the left for switching sound style / activating different voices/samples instead of normal "note" / waveform. Now I may stick to simple pitch and volume, maybe having a web control for other features (imagine your phone as knobs n buttons over wifi)
Going for the worlds smallest circuitpython theramin, but the speaker is so far the largest problem 🙂
Just curious because I have the same sensor but not used it yet: have you tried the multiple-object recognition? Maybe you could even play multiple notes at the same time. (Hehe, feature-creeping other people's projects)
You only have 8 pixels I think so with side-to-side pitch you would only get 8 notes. But idk if that matters for a theremin
I think the original library I forked doesnt have multi object
not too keen to do that before friday 😉
mp-extras/vl53 whatever
I have seen some designs that use simple photocells as sensors, as the shadow of your hand provides enough light difference to control something like pitch or volume.
My version, however, does not run CircuitPython, and is no contender for world's smallest.
oooh lovely tho
I did see a laser harp / time of flight instrument, looked pretty cool visually
I was mistaken, it does do multi object, just not per zone
Todo: More than one target per zone (fixed at 1 currently)
https://github.com/tyeth/vl53l5cx#todo
ah, thank you 😄
@tepid grove just a note (no pun intended): it's spelled "Theremin" with no "a"
thank you, thats instantly helped my searching a fair bit
After Leon Theremin, the instrument's inventor. Bob Moog was once asked to repair Clara Rockmore's original Theremin, and traced out the schematic while he was at it.
omg, thanks, love a good story/history, now my mind wants to make mine closer to the source 🙂
I know the feeling, hence my vacuum tube one.
When Paia came out with their "Theramax" version, they had a contest, where they had some Clara Rockmore T shirts printed up as prizes. Many people asked if they could buy the shirts, but they didn't want to use Clara's image without her permission. So they wrote her and asked. She explained that the date in the image was wrong, and gave the correct one, and gave her permission for the shirts to be made and sold if they'd give her a dozen of them to give out to her friends. They naturally were happy to do so. https://paia.com/proddetail.php?prod=CRT
I have so much to learn, my musical knowledge is weak, the video I watched was always on about knobs to adjust timbre (had to look it up), and the open source designs are fascinating too. I think an air version is limited in control unless you memorise a lot, but still possible, probably easier to have limited features, or additional external controls
I have an old vacuum tube electronic organ I'm restoring, and information on its circuitry is hard to come by. I finally found an industry newsletter published by a company that made neon lamps, that showed an actual schematic of how the organ oscillators worked, along with a description of how the neon lamps are used as frequency dividers to generate the lower octaves. I've had to learn a bunch of arcane information about music, electronics, and unusual components in the process.
Wow, the slightest snippet of info, I do love a treasure hunt, but those kind of projects are long term-ers, like shelve and wait for passive absorption of solutions
If you're curious: https://www.one-electron.com/Archives/Tube/Signalite/Signalite_Vol2_No3.pdf
And a glamour shot of the inside of the organ, showing the neon lamp dividers in operation
Never-endingly so...
That I understand. Some think it's a curse, but I regard it as a blessing.
Definitely both, a mixed blessing if you will 🙂 It drives us, while others around us are driven mad...
Okay Theremin/Audio fans, I see that I can change the sample rate in audioio / wav / mixer /whatever, and that will naturally shift the pitch, but what if I wanted to slow down a played WAV sample, and also modify the pitch upwards?
That would require more involved processing
Yeah, way beyond my level and probably cpy right now
How crazy am I to think i might be able to eat WAVs into ulab.numpy frame by frame...
not this week, but generally
Maybe synthio can help?
being able to adjust the WAV sample rate independent of the audio system sample rate is kind of a hack and only possible if you're not using any other audio system components like audiomixer or synthio. You currently cannot change the pitch of WAV files. If you want to change pitch you will need synthio or send MIDI
maybe an RP2040 Prop-Maker + the sensor + https://www.adafruit.com/product/3968, which unfortunately is out of stock. The other larger speakers are ok too
Afaik you don't actually have to get a "3W" speaker if you're using one of these MAX I2S direct-to-speaker amps.
If your speaker is less than 3W then it might theoretically break if you blast music too loud.
If your speaker is more than 3W then it should be no problem. The 3W amp will just drive it at max 3W.
Maybe knowing that might "unlock" you more options? 😄
(at least that's how a friend who does a bit of audio geeking as a hobby explained it to me. For example right now I'm successfully using a 15W speaker with that MAX I2S amp. Please correct if I'm wrong.
Imho it seems like a very big "simplification" to always just say "3W speaker required" for these kinda microcontroller projects. But literally everyone adafruit, pimoroni, etc does that)
Agreed. In general, any speaker with the right impedance will work. If the speaker gets hot or distorted, you probably want one with higher power handling capability, but for most signals, even a small speaker with a 3W amp will work fine.
the only extra detail i can think of, that isnt above
a 3000 watt speaker is going to have more mass to it
and may produce less volume per watt
so driving it with a 3W amp, may produce less volume
One advantage to larger speakers is they tend to be more efficient, so you get more sound from the same power.
oh yes of course! I wouldn't go completely overboard. I really should test those 30-50W speaker I got and how well they work with that MAX 3W amp
Of course, if you go to enormous speakers and lossy crossovers, you can lose volume
yeah, a larger cone will produce more sound, but i'm fuzzy on the losses from the added mass
and more bass! (I hope 😆)
For bass, enclosed, baffled, or horn loaded speakers will do a lot better than a bare speaker in free air
oh, I have some questions about speaker enclosure design coming up hopefully this or next week! 😄
An easy demo to do is take an ordinary cheap 2" speaker and run it in free air, then take a square of something with a 2" hole in it and listen to the speaker held against that hole. The volume and bass improvement is impressive.
even just the cardboard from a package? 
If you're going to design speaker enclosures, that simple demo is totally worth doing
Cardboard works, but can flex some, the effect is somewhat stronger with stiffer material (MDF, flakeboard, plastic, plywood (which is what I used)
Thank you! 😄 I think I will try cardboard later just because that's pretty much the only thing I have right now and can just cut a hole in 😭
I was thinking (got my first Adafruit cardboard box last week rather than just packets) that I'd do a larger one with prop maker and speaker in the box, and sensor protruding upwards through lid. Few pierced speaker holes, these speakers are very shoddy though, I really wanted that out of stock one - been checking for about 6weeks...
But the mini qtpy version is so lovely n small, already lost it once 😂
It's like a 1inch cube (plus speaker).
Got some speakers on order from pimoroni so fingers crossed they're a better fit / more svelt, while also being better quality than this donor Poundland speaker.
Maybe try glueing a reinforcement later to the cardboard. Lamination (layers of materials joined by glue and clamping) is surprisingly strong, even just paper and cardboard, but some plastic etc or any variety in material layers can add major benefits to stiffness or elasticity or other properties
good idea! Though I would only need this for testing. I hope I can make the finished thing out of wood then 😄
This is really cool! And much more usable than doing theremi-stuff with touchio raw values (e.g. https://gist.github.com/todbot/bb4ec9c509f8c301e4787e5cb26ec870 )
I've always wanted to play with those time-of-flight sensors. Looks like they're nicely accurate!
Supposedly you can improve subwoofer sound quality even in a box that's too small, by filling it with quilt stuffing. Normally if the box is too small, the small air volume will restrict woofer motion, reducing volume (but making the bass "tighter" sounding aka more accurate), but the stuffing impedes the pressure wave going through the box, sort of simulating a box with more air space. This would probably also help with a box made of more flexible material, because impeding the pressure waves will cause them to have less energy once they reach the walls.
Those sensors are pretty great although they sometimes work less well in bright sunlight because they use infrared to gauge distance (if we're talking about the tofl sensors I think we're talking about)
Sadly yeah the sun is the problem, but they do support glass covers to reduce and cross talk elimination (if you bother to calibrate with your cover glass).
Also found out the Motion detection is limited to minimum 40cm and max 150cm, but that 400mm is too much for a desktop sensor. Would work well for the floor / standing version though (cardboard box will be desk and/or floor model. You calibrate the poisition/noise of you standing, with arms down, then raise one to top of comfortable zone, then bottom, then right, etc).
Ideally I'd update the firmware, but there's been changes to return silicon temperature which means the mp-extras/vl53l5cx library is no longer compatible with latest firmwares / ULD.
For that kind of range, you might want ultrasonic or some other technology (microwave, depth camera, triangulation, etc.)
Thinking the camera eventually, but keen to play with mWave sensors too. Ultrasonics are cool but bulky. Having seen the Useful Sensors person detector (<1mb webcam with onboard ML for a few faces in memory and basic person grid refs.) I wonder how long before we can do that via GPL for under $5. (It's $10 and using NDA stuff internally I believe right now)
dark magic confirmed 🤯 just laying this cardboard on top already makes it sound way better
The sad thing is, this might already sound better than my PC screen speakers
can confirm, they work great. "rated power = 30W; maximum power = 50W; 4Ohm". (the one in the pictures above is only 8/15W)
lol, don't, the cheap speakers I sacrificed are no match for the 3W 4ohm ones from pimoroni (similar/same as adafruit), but still bigger than device. All sound better than my TV. Larger rectable speaker is gonna work well for the boxed version. To be fair I should stop using a speaker and move to line out + midi options, but battery powered theremin box will be cool, and the qtpy version is just amusing...
could you mount the QTPy and I2S dac (or what are you using?) like this to make the box exactly as large as the speaker? 🤔 😆
All sound better than my TV
seriously, it really surprises me how easy it apparently is to get "better than mainstream consumer devices" audio 😆
I like it, similarly I thought of the small square upside down (with tiny corner feet) making a 1inch cube (the sparkfun board was 1" the rest is 0.7-0.95" approx, but I swapped the sparkfun mini ToF for pimoroni one which is smaller still)
that also sounds like a nice idea!
The sizes are amusing, but I didn't think about the orientation of cables and lost a little, plus the SD card is huge so a stubby would help, and my capacitive touch "button" (the resistor on corner) could be squeezed in too.
Oh and its the Audio BFF in answer to the i2c dac question. Wanted to see if could use samples on one side and theremin the other, but long term aims, for now its going to play an optional drum loop / music to play along to.
There are some smaller good sounding speakers out there, they're used in laptops and model railroads.
oooh railroad speakers! I did have a laptop one or two somewhere, but they were longish rectangles or odd shapes.
Yes, they do tend to be odd shapes.
Just sharing here
The sample library @VenusTheory and I made is here: https://www.decentsamples.com/product/motorlab-by-venus-theory-dave-hilowitz/
Classically forgot to factor a few things in before CPY day, including not appreciating the theremin needs horizontal resolution not vertical (where this sensor "shines"). Now added the larger Sparkfun version on top of the Pimoroni one, but at a good angle, and going to try using both to give that better horizontal (or 2 references basically and some maths). Also just made possibly the worlds smallest / cutest StemmaQT/Qwiic/JST-SH cables, one about 8mm, one 25mm.
not sure we're still under an inch anymore
Inspired by last week's synthio session on Friday (thanks!) I've got a few project ideas using RP2040s and building button based interfaces. However I wondered if I could use the pimoroni Keybow 2040 I've got as a basis for a tidy synth? It has got 4x4 keymatrix with RGB leds, but it only has a limited number of pins broken out as solder pads.
UART-TX (GPIO0), UART-RX (GPIO1)
INT (GPIO3) , SDA (GPIO4), SCL (GPIO5)
However, gleaned from a pimoroni support forum looking at SPI display support, the latter three pins INT, SDA and SCL all have hardware 10k resistor pullups. (schematic is here https://cdn.shopify.com/s/files/1/0174/1800/files/keybow_2040_schematic.pdf?v=1629994431) Would that make it impossible to connect a MAX98357 i2s amplifier and drive it from circuitpython? (moved from help-with-circuitpython)
I2S is a digital signal, and 10k pull-ups are weak enough that digital outputs should work just fine.
I don't think I2S should generally have pullups though.
Ideally, no they should not.
You may have to reduce the clock rate/sampling rate to get it to work really well.
@odd oasis they're intended to be on the SCL/SCA I2C set up, but the board exposes very few pins, so I wanted to see if I can get the amplifier to connect over those pins. - thanks!
Depends on the chip(s)
seems to work
Just tested it with that Adafruit MAX98357, Pi Pico, 10kOhm Pullups on Data and Bitclock, and 3kOhm Pullup (because I only have 2 10kOhm resistors 😆) on LRCLK on my crappy breadboard. It should be 16 bit 48000Hz
... which means that you'll need a clock frequency of at least 2*16*48k = 1.536MHz (two channels, 16 bit audio, 48kHz).
That's really pushing it for a 10k pullup.
And that's assuming zero overhead and no gap between samples.
Afaik I2S has no gaps between samples
yeah
just left,right,left,right and so on
and i think I2S also uses the data clock, as a reference for the DAC playback rate
Ah
Technically the rp2040 is driving that output, so I’m thinking it should be a push pull driver?
so if your i2s clock is jittery, your audio will play back at a jittery sample rate
echoing what others said, I think the Keybow 2040's INT/SCL/SDA lines should be fine for I2S. Alternatively, you could wire up a RC filter to one of the UART lines and use it as a PWM audio line out
kinda disappointing that this board doesn't break out more GPIO. It looks pretty big = enough space to me
yes the pullups are integrated into the board, which has the microcontroller on it, I think Pimoroni changed tack after this and take a different approach now.
could always get in there with a soldering iron and knock off those pullups 🙂 it's one resistor pack I think
thanks all, my first question on here and lots of help
It’s a keybow, and I think they directly tied each switch to their own gpio.
I'll get the soldering iron out and see what happens when I wire it up
on the schematic at least 7 GPIO look free
PIO could also put i2s on the uart, and if that lacks pullups?
but thb I know nothing about PCB design 😆
only some of the GPIO have solder pads, the two UART ones and the three for I2C
need three pins for I2S tho
is there a 3rd gpio available somewhere?
maybe L/R clock could go on an i2c pin, its slower, so the pulls wont matter as much
2 consecutive + one that can be any pin. (at least with Arduino. I suspect Circuitpython is similar)
PIO can use any contiguous sequence of pins.
Oh so they are. For some reason I thought they had a display and a voltage monitor, but I’m probably thinking of a different board…
yep, definitely try out the pin combo you want in CircuitPython (you don't need any hardware hooked up) to see which ones work. I'm always doing that for prospective RP2040 layouts, where I just grab a Pico and start doing
# hmm will this work
audio = audiobusio.I2SOut(bit_clock=board.GP0, word_select=board.GP1, data=board.GP2)
sideset can use a second of up to 4 pins
Yeah that too.
this is the board - https://shop.pimoroni.com/products/keybow-2040?variant=32399559622739
You could just side set everything with PIO.
btw random question: What I2S implementation does Circuitpython use? 🤔 The one from Raspberry Pi? (I'm just curious. Please don't waste time researching it if you don't know)
runnning the pin enumeration code from adafruit and then trying
audio = audiobusio.I2SOut(bit_clock=board.INT, word_select=board.SDA, data=board.SCL)
seems to work
board.GP0 board.TX (GPIO0)
board.GP1 board.RX (GPIO1)
board.INT (GPIO3)
board.SCL (GPIO5)
board.SDA (GPIO4)
is the beginning of what the Keybow 2040 reports
Because Arduino-Pico has a newer I2S implementation that allows with or without MCLK (limitations apply), input or output, and 8, 16, 24, 32 bit per sample. While the raspberry Pi companies I2S can only do 16 bps
my understanding is that it's very similar to the PIO-based one used in the earlephilhower arduino core, which is based on the one in pico-examples from raspberrypi. and it only needs 3 pins, no MCLK needed
I'll solder it up and see if it works
Iirc at some point the I2S in the Earlephilhower-core was basically completely rewritten. Not sure if it's still based on the pico-examples.
And MCLK support is very new like last month or so and completely optional
but tbh 32bit audio is probably kinda overkill... Right now I can't even play a 16bit 44000Hz wav from SD card with features like fading, volume control, etc 😆
Soldered it up and no audio from test tone script. I’ll look again later
It works! I disconnected the board last night and when I powered it up this evening, it worked first time. So that's pleasing, thanks for your help everyone especially penpingu for going to the effort of mocking it up as a real circuit.
I'm using the Adafruit MAX98357A breakout board and it seems like it can get overloaded or overdriven somehow
as the sound gets louder, there's a point where it just cuts out and needs a power cycle to come back
I'm definitely using it within spec on the output side; how can I avoid this on the input side?
I'm using circuitpython
Could be a power supply problem
Everything else seems happy enough, but I guess it's possible
In some random YouTube video I don't remember anymore they guy had to add a capacitor because the power supplies voltage dropped too much. (Yeah, I know not the most reliable source lol)
That's why I bought a capacitor kit "just in case" but I didn't have to use it yet. At least on my PCs USB ports "way louder than comfortable" is no problem
Btw how are you powering the amp? You can power it with 5V even when your microcontroller has 3.3V logic level.
running directly from the USB 5v line
MIDI question: Can a Macropad RP2040's STEMMA QT port be used to output serial MIDI? How about Input too?
Probably needs to be some kind of a hack not using the pins for that port configured for I2C protocol, as I don't think I2C can do MIDI IO (but maybe?)
Yes, I think so. todbot built this to get audio out: https://www.tindie.com/products/todbot/macropadsynthplug-turn-rp2040-into-a-synth/
I think MIDI is just asychronous serial (8N1), at 31250 bits per second. So you can generally use any UART (or even soft serial). There's some signal conditioning you need to do as well, as it's isolated current loop signalling, but that happens outside the CPU.
That is, in fact, what the todbot board does. Since the pins used for STEMMA I2C are also usable as serial pins, it does so.
thanks @glacial spruce I'm thinking of wiring up a DIN 5 connector for MIDI Out thru 220ohm resistors to a STEMMA-QT connector-plug wire. Then configure the RP2040 pin that goes to the STEMMA QT connector on the MacroPad to act as a UART TX. Like this https://electronics.stackexchange.com/questions/623026/problem-working-with-midi-on-hardware-serial-port-on-raspberry-pi-pico-2040
That's not a technically compliant implementation, but it may work.
Ok maybe I just buy an Adafruit MIDI featherwing and wire that up to a STEMMA-QT wire/plug?
That would likely work, and has the advantage of already having the DIN connectors mounted
Then you can mount your StemmaQt boards with DIN connectors onto DIN rails 🤯
https://www.printables.com/model/512753-v22-qtqwiiccliq-din-mount-for-stemma-qtqwiicthing-
Sorry for the shameless self-plug, but the opportunity was too good to pass up.
Yep you can totally do that. The SDA/SCL lines of the MacroPad RP2040's Stemma QT port go to the RP2040's GP20 and GP21, which are UART1 TX and RX. I really debated making a MIDI In/Out version of my MacroPadSynthPlug just for this reason!
is there a "safe" way to filter the PWM carrier coming from the MAX98357A breakout so it can drive a line out?
While you could do so, using an I2S amplifier as an I2S DAC seems like an odd approach.
I'd like to be able to have it default to speaker output, but able to plug in for recording
I think it's fairly high frequency PWM, so you should be able to make an LC or even RC filter. You might need a transformer to isolate the differential drive to a single ended one like a line out, as well.
i can think of 2 options
1: get a pair of i2s dac's, one for driving a speaker, one for driving line-out, assuming they are compatible
2: just convert the "analog" side as needed
I have some switching audio jacks that I was planning on using
Yes, you could use an ordinary I2S DAC to get the analog signal, then follow it with an ordinary analog amplifier for speaker level
Doing it with switching jacks seems like it would be pretty complicated.
thinking that if I need a transformer anyways, I can just have the speaker hooked up to the output terminals of the jack (so they're disconnected when a plug is inserted) and record through a passive DI
You want to take a digital signal, convert it to PWM, convert that to analog, then route it to a DI to turn it back to digital? Color me bewildered.
DI is analog, just an audio transformer
aka "direct box"
I don't have a way to directly send the digital audio stream to my recording equipment
ive seen somebody bit-bang SPDIF optical, on the pico status led before
i'm sure you could also find i2s->optical converter chips
I would have used the UDA1334A breakout but it's been discontinued
@cursive rune if you’re looking for I2S modules with line out, I’m a fan of the cheapie PCM5102 ones you can get off Amazon or Aliexpress
Lots of uda1334a modules on eBay and AliExpress
I’ve been experimenting with an analog circuit for this — works with or without a connected speaker. Here’s the backpack version for that amp. I’m also building and testing a more flexible version to act like a traditional self-powered DI. https://github.com/CedarGroveStudios/PCB_Reintegrator
Can you link the adafruit amplifier module please
Good afternoon! I'm doing an audio project and want to use the qt py (I have 3) and I have a few of the qt py audio bffs.
I want to get the LiPo bff as well but want to make sure of a couple things: 1. Any issues with connecting both the audio and the LiPo bffs together?
- Like the audiofx board, I want to wire in a button to play sounds. Sounds pretty basic, but just want to ensure all these things are doable. Thanks so much!!
Yes, the lipo bff uses A2 for a battery monitor, and the audio bff uses the same pin for I2S word select. You won’t be able to stack all three unless you cut the battery monitor jumper.
Also worth noting, the qtpy M0 will not work with the audio bff.
With the i2s using a1-a3 and micro SD using a0 and the spi pins, you have the uart and I2C pins left for wiring any buttons or other devices. Of course, you don’t need to use an I2C or uart device, as these pins can be repurposed as GPIO.
Thanks Hem!
Back to the drawing board.
Wait... Is the battery monitor required for LiPo charging or is it just data on the charge state for display? Thanks!
The latter.
Hello, do you guys reckon this type of relay would work to send audio data over? i want to kinda use those relays in reverse, at the output i want to send on one part audio data from an esp32 and the other output i want to send data from my computer, and at the base i want to have the final jack that goes to the speakers. Basically, I want to switch between two audio lines with a microcontroller
I am worried with this approach that 1. the relays are unidirectional, 2. the relays will not keep the audio data intact
If it helps, I am using this DAC's L, R channels for the ESP32 part. it's using an I2S interface:
That is if a relay is a good solution
BTW please ping me, I am in God knows how many servers lol
No, relays are not directional, you can use them as multiplexors or demultiplexors. They're basically just electrically controlled switches. As for keeping the data intact, they're not shielded, so you may get some noise pickup. Also, those are relays with contacts designed for high voltage and high current, they may introduce some resistance/crackle in a low-level signal like that.
do you know of any relay that could work for such use case?
There are signal relays designed for such use. However, it's often easier to use "analog switch" ICs to switch the signals electronically
solid state relays?
they should remove some noise because they are not mechanical
Solid state relays are quieter, but they're designed for switching power and can introduce crossover distortion when switching low-level signals
hmm
Something like a CD4053 chip can do the job
let me look it up
Or a CD4052 if you want to do stereo
Hey all, 👋 , looking for some pertinent and timely guidance on a project that I'm a bit in over my head on and have a looming deadline for (week from today). The end goal is the ability to record people speaking for arbitrary lengths of time to file. To this end I put together a hardware setup with an RP2040, the Adafruit PDM mic breakout board ( https://www.adafruit.com/product/3492 ), and SD card hooked up via SPI.
I am struggling with the audio acquisition. Attempting to record at 16-bit, mono, 16kHz. It is my understanding/assumption that the PDMIn class from CircuitPython does the filtering/decimation needed to produce audio samples. The documentation says the samples coming out are 16-bit, unsigned. I am taking the buffer of samples, offsetting them by half the max of an unsigned short to scale to the signed range, and then writing to an opened adafruit_wave.Wave_write . e.g.:
data = struct.pack(f'<{struct_size}h', *signed_samples)
self._wav.writeframes(data)
I don't seem to be getting anything resembling usable audio when I play back the WAV.
There are no examples I can find that demonstrate how to record audio to file with this PDM mic breakout board and CircuitPython. The only example of usage I can find is this: https://learn.adafruit.com/adafruit-pdm-microphone-breakout/circuitpython
More worryingly, this message #help-with-audio message seems to imply that it is not even possible to record uninterrupted audio beyond what can fit in RAM.
Any guidance would be appreciated, or suggestions for a different hardware setup that I could quickly pivot to via paying too much for shipping. This is all battery powered and being crammed into a small shell:
Record to a file on what? Local or remote? Compact Flash? HDD? Something else?
SD card via SPI bus
The message you linked provides the important bit of information: this is not something CircuitPython is particularly good at. Personally, I'd use Arduino for a project like this. Failing that, you'd need to write some code to double buffer your audio, reading into one buffer while writing the other buffer to storage.
I don't know of any example code, unfortunately.
Another approach is to punt the RP2040 and use something like a Pi zero
If I have to, I can pry the Pi Zero out of my 3D printer, there's just not much time left. As it currently stands, I made a custom carrier board for the RP2040 stamp, and the board hosts the microSD card slot and connector for the Frone numpad.
While there may not be any example code, exactly, would you be able to provide guidance on the correct way of going from PDM mic breakout board -> samples that could be written out as recognizable audio?
Alas, I've never used that particular board
Well, regardless, thank you for your insight. Maybe someone else will be able to chime in.
So where I'm at now is that if I take the samples straight out of the buffer given to PDMIn, offset them to be signed, and then write them raw to a file... I can import the raw samples in Audacity, applying its Normalize effect (which also removes DC offset) and I get what appears to be an extremely noisy and sped up version of what I recorded. If I halve the sample rate in Audacity it's still very sped up but becomes somewhat intelligible as the thing I recorded.
(barring the extreme amount of noise)
It seems to be off by a factor of 8? If I scale the speed in Audacity by 0.125 the audio is awful, but it's the right speed pretty sure.
The PDM input is configured for a 16kHz sample rate.
It seems like there's a mismatch somewhere. Perhaps the samples are more bits that your encoding is accounting for, which would cause both a speedup and distortion.
Python hasn't been crying about a mismatch during the packing into a byte array, though.
Most of the packing functions take your word for the data format, as Python doesn't really know what the format of the byte array is, other than it's a byte array.
So, this is an example of one buffer's worth of data: https://bpa.st/POMA
Where the packing is done via struct.pack(f'<{len(signed_samples)}h', *signed_samples)
That looks right side up and frontwards to me
Unfortunate.
Thought: Could this somehow be a case of time between buffers being significant?
As in, the time is inadvertently compressed because regular intervals of audio are just missing.
@random bone Feel free to ignore (and sorry for) the ping, but saw that you had cropped up in previous related discussions. If you find time or the desire, would appreciate whatever insight might be given.
Audio input does not have a lot of viable use cases because of the limited amount of RAM available, and is mostly for sound and pitch detection and the like. So I'm not surprised it is not working well.
Make sure you have the sample size correct (8 vs 16 bits). and you are importing the raw file correctly (mono, correct sampling rate, etc.). Anything wrong there could cause accidental factors of two.
If you have some non-RP2040 board that supports PDMIn, you could try the same PDMIn program and see whether you have the same speed problems.
Using adafruit_wave.Wave_write to create a WAV file and write to it. e.g.
self._wav = adafruit_wave.open(self._filename, 'w')
self._wav.setframerate(16000)
self._wav.setnchannels(1)
self._wav.setsampwidth(2)
. . .
self._wav.writeframes(data)
and the mic configuration:
self._mic = audiobusio.PDMIn(
self._clock_pin,
self._data_pin,
sample_rate=16000,
bit_depth=16,
mono=True,
oversample=64,
startup_delay=0.11,
)
There was a bug, reported in https://github.com/adafruit/circuitpython/issues/5914 and fixed in https://github.com/adafruit/circuitpython/pull/5993. You might try 7.3.3 and see if it works better than 8.2.6.
PDMIn uses a quite low-quality digital filter in order to keep up with the input (same filter used on SAMD21)
Would it be possible to just get the data from the microphone and post-process later with a better filter?
I don't need any real-time processed audio.
The PDM data is at a high clock rate, much higher than audio, so something has to be done to it. You could use analogbufio and an analog microphoen
what are you doing with the audio signal?
are you trying to actually record sounds?
do you have any non-RP2040 boards that run CircuitPython?
I'm trying to record The Human Voice™
The only other microcontroller board I have is the Pi Zero W currently installed in my 3D printer to add wireless management to it.
what length of samples, in seconds?
I could pull that.
More context: The intent is to have this serve as an "audio guestbook" at a wedding where people can leave messages to posterity for the happy couple.
there is not enough RAM available to record more than a few seconds of audio. A Linux computer like an RPi would be much easier to deal with in this case
I do have a Pi 4, but there are space constraints, unfortunately.
Fitting the hardware inside of this frog.
I'll just go pull it out of the printer
You think it would work well in this capacity, though?
for sure, it has plenty of power and RAM; consider comparing it with an old PC from 20-30 years ago which could also do this work
What about power draw?
The battery I have is..
one sec
I think it's your 2000mAh one.
I don't know what I'm expecting for runtime, but probably several hours?
so there's no way you could just plug it in somewhere?
easiest way to get audio in on Zero W is to use a USB audio dongle, like https://circuitdigest.com/microcontroller-projects/how-to-use-usb-audio-device-and-microphone-on-raspberry-pi-zero-w
No, another fun constraint is the need for it to be wireless.
well, you could use a phone, and the frog could sit on a "rock" with a phone inside
do you want to play back what they said?
or anything could be in the "rock"
pi something, big battery, etc.
Well, it's funny you say this.
Vetco does have one of these USB sound cards, so I could run over and get it tomorrow https://vetco.net/products/usb-audio-dongle-usb-sound-card/vupn6862
I also had some neopixel eyes for the frog, and had retrofitted the numpad with a connector to use the keys for guests to punch in a number related with them to better correlate recordings to a person in case they don't say who they are/don't speak clearly.
@tidal swift There is code for that very thing using a Teensy and it’s audio board. It’s not easy or flawless …or the thread wouldn’t be 445 messages long. https://forum.pjrc.com/threads/70553-Teensy-4-0-based-Audio-Guestbook
I built the project shown under this Youtube entry using a Teensy 4.0 and the 4.0 Audio card and a Sandisk Ultra 32 GB micro SD card; it sort of works but there are issues that I see have been experienced by others (towards the end of the comments under the video). The code implements the following sequence:
- After initialization, a beep i...
But would be happy to drop the numpad and eyeballs.
I shipped my Teensy 4.0 to a friend to try out M8 Headless, unfortunately.
But could order one with fast shipping.
is this like this coming weekend?
😎 Yes.
I've had some unfortunate work deadlines these last few months
Didn't have time to pick the project back up until now.
Started late May.
having been at a wedding recently, the interaction we had with the "group selfie" picture taker was a lot more fun than, say a 35mm camera on a tripod with a remote shutter release
it as a tablet thingie
how about an old cassette recorder gussied up? old school, fun to play with, can play back, not centered around technolgoy
or just that voice recorder you showed above, or is that not your project?
Frog is a particular request from the couple.
That's my recorder, and the inside of my frog.
And is the backup option here, yeah.
I'm a professional software dev with no hardware experience, and said yes to my brother's request to hack this thing together, figuring it'd be relatively turnkey. I underestimated, like always, and time has really flown by.
I think Plan B is the right approach, not sure what else I can say. It's Monday
Probably, yeah.
no one at the wedding cares that you coded it yourself 🙂
sorry to turn this into an xy problem discussion
Always should.
Sure, but to some degree it's a labor of love and a gift to brother + soon-to-be sister-in-law.
my view about software is that being constructively lazy is often the right approach. I'm sorry we can't do what you want in CPy, but there are a lot of hw constraints.
USB sound dongle also probably available at Best Buy, etc.
Agreed.
Visiting Vetco means (probably) being able to pick up anything else that might be required for the hypothetical Zero W pivot.
the recorder you have is a plan, and so is a USB dongle + mic + some python script that reads buttons from the Zero W pins and records audio with, like arecord or something
or maybe sox
I also have a lavalier mic laying around somewhere
or find a usb microphone, there are small ones, or it's a cute-looking accessory
depends on whether you want playback or not
if not vetco, microcenter if you have one
something like this: https://www.adafruit.com/product/3367
obviously no time to order from us
i have to sleep, good luck, sorry for the stumbling blocks
Thank you for your time and wisdom. Haven’t found the mic, but have scrounged everything else I think.
🛠️
🤷♀️
Ended up finding this project: https://github.com/sandeepmistry/pico-microphone built and flashed to my board, and the audio sounds great. Just need to figure out Arduino now and how to incorporate the microphone library here with it I guess.
@tidal swift any idea of the maximum length recording?
euphemism any idea of the maximum
why is it hummint like this?
and when I grab the amp circuit of the input source,
it decreases a lot of humming noise all of a sudden
why?
Do you have a ground loop somewhere? By touching it you are adding capacitance to ground through your body
I don't know 💀💀💀
this is def coming from input amp circuit
cuz when I take the input from the amp circuit off, there is no noise from speakers circuits
Yup, noise coupling from the AC mains
coupling from AC main? how do I solve it then??
this is the power source I have
Shielding. You'll need to incase all the small signal handling wires in shielding connected to a low impedance point, while also avoiding ground loops.
It could also be power conducted from that power supply, but that's easy to test: if it goes away when using a battery for power, the power supply is the issue. If it doesn't, then you have hum pickup from ambient to contend with.
then should it be the wall? or my power supply cord?
and I don't understand "have hum pickup from ambient to contend with" part. What does this mean? I googled hum pickup and it shows me guitar products
Afaik: Basically, every wire is an antenna. And there are a lot of radio waves in the air, some from wifi, radio, bluetooth, etc, others from random wires or traces on PCBs (that are also antennas) that just emit random radio noise. So your wires can pick that noise up, it get's amplified -> noise in your speaker
Then it's coming from that wall supply, so you would need either a cleaner wall supply, or some filtering between the supply and your circuit.
ahhh yeah right right 💀💀💀
hmm ok I will google a bit and if I need your help again I will let you know!!
Let's say I have to use that bad wall AC supply. What should I do to filter it out? Is there a filtering product for this?
The easiest ones are R/C or L/C filters, after that, you get to assorted more powerful techniques. One of my favourites is to add a linear post regulator to actively smooth out the power. However, you need some voltage headroom to make this practical.
@random bone @glacial spruce Ended up pivoting to PlatformIO + Arduino via this core ( https://arduino-pico.readthedocs.io/en/latest/ ) and was able to utilize that library I found. Countless hours of me flailing about/sleeping very little, and got it working for the wedding on Sunday.
Was too late for the Pi Zero W in my printer, though. Had already pulled it out and mangled the 26mm pins during desoldering.
I'm running into an issue on my pico w using circuitpython and audiopwmio to get a chime to ring on a button press. It's all functional, I get audio out, but at the start of playback of any sample there is some clipping and destortion. It only occurs at the start of playback, my audio source is clean, and if I loop the sample in the playback there's no distortion when the start rolls around again. Anyone got any pointers or tips?
What kind of distortion are you experiencing? Is it something similar to https://github.com/adafruit/circuitpython/issues/5136 perhaps?
Also I recommend using “AudioMixer” on top of your audio object and have it play your WavFile objects. It keeps the audio system running. Normally at the start of audio playback there is a bit of a glitch as the pin voltages stabilize. AudioMixer helps by keeping the audio system always running (but silent)
Looks very much like what they're describing here, thanks for having it on hand or finding it! I'll twiddle around with continuous audio out and/or try some other (types) of PWM pins if I have that option.
I'll have a look at that class, see if it makes a difference, thanks :)
Hi I used this one to supply 12V DC power and my microcontroller that can take upto 12V got hotter and fried up.
And I checked with the output with multimeter and it says 24V
Why was this putting out 24V instead of 12V?
Yikes. I'd guess it was a screw-up at the factory... they probably make both 12V and 24V items and the labels got switched between the batches or something.
wowww ok I actually ordered two of them
I will try another one and if it's really the problem of then mis labeling,
Is it possible for me to ask them for replacement and also pay for my fried microcontroller?
That probably depends on who "them" actually is.
wait but am I doing it right
I get the same result with the other one too
ohhhh wait
No, your multimeter is set to AC volts. You want to use the settings to the left.
my bad
The microcontroller that I was using could take upto 17V.
Why did it fry even when the input voltage was only 12V?
Possibly there was some other problem with the circuit, like a short on one of its outputs causing the microcontroller to pull too much power.
hmm. ok thank you so so much for your answers
Sorry if this is a dumb question, but does anyone know the voltage range of a magnetic tape play head? I'm trying to determine what kind of amplifier I would need for one.
I would guess millivolt range, but possibly 100µV or so? I haven't tried scoping one.
A web search yielded this helpful page (looks like 130-2000µV from a quick skim) http://lcweb2.loc.gov/master/mbrs/recording_preservation/manuals/Nortraonics Magnetic Tape Heads Specifications.pdf
That's the playback voltage, the recording end of things is somewhat more complex, due to bias, equalization, etc.
Oh, thanks! I'm just trying to see if the tape head on its own would be usable with a standard phono turntable preamp.
Seems like it might be compatible, just a little quiet?
I'd have to check my tape deck's manual when I get home.
Some phono pickups (moving coil I think) are very low output
hi! im trying to use the music maker featherwing with a esp32-s3 reverse tft feather (https://www.adafruit.com/product/5691) and trying to run the example code from the vs1053 library. nothing shows up in the serial monitor except for "Adafruit VS1053 Feather Test", so im guessing its getting stuck at musicPlayer.begin()? im not sure how to get it working
Like Missy Elliot, we like to "put our [Feather] down, flip it and reverse it" and that's exactly what we've done with this new development board. It's basically ...
Ahhh I really want to get rid of this hummingggg
It is definitely coming from input amp component
That would make sense: the lowest level circuitry will be most susceptible to hum.
could you elaborate more please? ahh I feel like I am not making any progress for past few years 💀
Basically adding a small amount of hum to a small signal will make a big difference, but adding the same amount of hum to a stronger signal won't.
uhhhh I don't get it. Is my input signal not strong enough?
I doubt you can do anything about that, so the remaining approach is to reduce hum pickup by your input circuitry.
hum pickup? I am so sorry I don't understand what that means
Basically, the noise is getting amplified along with the signal, so you have to figure out a way to reject that hum at the input stage.
It would help to know what you are amplifying, and what is causing that noise.
Is your 1/4” cable shielded? And do you have the shield grounded?
I am amplifying piezo with LM386, and I would like to know what is causing the noise
It is 99% the input section bc when I unplug the LM386, it's quiet so it's not the speaker amp
yes those black cables are shielded. And those are speaker amp so it's not causing the noise anyways.
You may need to shield the entire piezo pickup, as it may be acting as an antenna that picks up ambient hum
Piezos are noisy
It’s hard to tell what you have connected to what, but I think I see a lot of unshielded wiring.
Two things you may want to investigate: humbucker guitar pickups, and piezo pickups.
Guitars also need to amplify a tiny signal in electrically noisy environments, so they have to solve the same problem you are having.
Humbuckers are basically two guitar pickups wired together such that they cancel out the hum.
Here’s a thread specifically about piezo pickups and solving ground hum:
https://www.acousticguitarforum.com/forums/showthread.php?t=426173
Piezo pickups and hum Acoustic Amplification
ahhh ok
ahhh interesting!! I will look into it thank you so so much m!!
@unborn drum Hi, I just checked out that forum, and I found it's quite similar to my situation — especially this line "Most of it goes away when I touch the endpin and even more when I touch the endpin and a metal object"
Since I am not familiar with guitar jargons and how pickups work, I actually did a little research and learned a little tonight.
The basic principle behind humbucking guitar pickups
This guy was so good explaining the principle of humbucking pickups.
Even though it's the method used for electromagnetic pickups, not piezo pickups, it was interesting to learn how it works.
While reading off of Wikipedia page about Pickups, I found this term "mains hum"
Mains hum, electric hum, cycle hum, or power line hum is a sound associated with alternating current which is twice the frequency of the mains electricity. The fundamental frequency of this sound is usually double that of fundamental 50/60 Hz, i.e. 100/120 Hz, depending on the local power-line frequency. The sound often has heavy harmonic conten...
The hum from my setup exactly sounds like 60Hz Hum in the example! (You can hear different hums in that page.)
I think my main problem is trying using the shielded wire and get a solid ground connection like the guy in the forum says.
But what does it mean getting a good ground? Shouldn't it be done when I connect the (-) to the (-) rail on the board?
And while I was learning about guitar pickups, I watched this video
In this episode of Tech Bench, our tech Paul walks us through what pickups are and how they really work. We'll cover the different types of magnets and the materials that are used in pickups, the bobbins, the pickup wire, how they're wound and the difference between phase and series. That's not all! We'll talk about potting, polarity, the differ...
When they make guitar pickups, they dip the pickup in wax, this procedure is called "Potting"
which helps all the components tight and secure, also protects from microphonic feedback noise
Do you think dipping the piezo in resin can also help?
So to summarise my questions:
- Using shielded audio cable (typical thick, black one) would work fine when it comes to shielding, yes?
- What does it mean by getting a good ground? How do I achieve that?
- Does dipping the piezo in resin can also help preventing unwanted hum or noise?
Oh, btw anyone other than @unborn drum can hop in and leave me comments.
I am so dumb I need your advice
Thank you so much for reading the long texts.
You aren’t dumb, you’re learning! As are we all.
Regarding cables, the most important part is to have the signal wire encased in the grounding.
This is starquad cable, you can see the braided shield completely encloses the signal wires.
You want this shield to be connected to ground, so that any interference it picks up has somewhere to go.
Another term you’ll want to research is “balanced audio,” where the signal is sent over three conductors (positive, negative and ground) instead of two. One of the two audio signals is phase-reversed before being sent down the wire, then it gets un-reversed and summed with the original audio. The result is cancellation of any noise that the wire picks up.
Starquad cable allows for balanced audio, and in addition, it uses two pairs of twisted wire (four conductors) to carry the two internal signals, which further reduces noise.
Here’s a link about using two piezo elements to create a balanced signal:
https://www.instructables.com/Balanced-piezo-contact-microphones/?amp_page=true
Dipping the element won’t help in your case, because the piezo doesn’t have a big coil of wire that can vibrate.
I have a few more thoughts:
-
If you are sending audio signals through the breadboard, you can’t really shield them. Ditto for the signals that pass through that 386 board. You might want to consider enclosing all that inside a metal enclosure. And grounding that enclosure.
-
Are you powering any part of this from the wall besides the amp? If so, you might have a “ground loop” issue. (This can sound pretty similar to mains hum)
And actually now that I think about it… why are you using both a 386 and a guitar amp? I would think the guitar amp has plenty of gain on its own, and shouldn’t require a preamp. Am I missing something?
Oh ok so basically use shielded cable and connect that entangled ground cable to the ground rail, right? when you say ground, it means ground rail right?
ahh so is it like, using stereo audio cable and using two piezo element sandwitched together, acting like a one mic but noise cancelled?
interesting I might try today or tomorrow
A. Using breadboard, unshielded wires and cheap guitar amp was just for the sake of quickly testing things out to see "if it works". But now I clearly understand that it is definitely not a good idea to ALSO expect "perfect" result without any noise with that kinda setup.
I was powering the whole circuit with straight from the wall, but now I am using AC to DC converter that put out constant 12V
and I use another power converter board that does 12V to 5V conversion
That was powering the breadboard.
I didn't have any of this humming issue when I was testing out at home, even though I was using the power straight from the wall.
But as soon as I bring all the set up to school lab and try similar stuff, all kind of problems showed up.
And the reason I am using that cheap LM386, is that — I tried using other circuits, other methods, spent almost more than a year to build a better circuits out there, but it all failed. And no matter what people say, that cheap LM386 worked the best for my purpose so far.
It provided me enough gain with clear audio signal ( when I was testing at home haha)
I am an artist, not an electric engineer. Ofc I love learning new stuff and trying new things, but considering that I have limited amount of time to finish my project, and my main focus is not on building amplifier circuit, I don't have too much time to spend on choosing the "right" amplifier. I chose what works best for me currently, which is that LM386 board that I bought from Amazon.
https://www.amazon.com/HiLetgo-LM386-Audio-Amplifier-Module/dp/B00LNACGTY/ref=pd_ci_mcx_mh_mcx_views_0?pd_rd_w=eAb5h&content-id=amzn1.sym.225b4624-972d-4629-9040-f1bf9923dd95%3Aamzn1.symc.40e6a10e-cbc4-4fa5-81e3-4435ff64d03b&pf_rd_p=225b4624-972d-4629-9040-f1bf9923dd95&pf_rd_r=6Y26MZ8QWP15PA2W32QN&pd_rd_wg=wyWgI&pd_rd_r=9d7847f5-2060-475d-a95d-572209612e8c&pd_rd_i=B00LNACGTY
I do this kind of sound installation featuring ant colony. Basically I place piezo elements inside of their nest, and amplify their movement and social behavior, do real-time sound synthesis with those input signals.
I was connecting each piezo straight to my laptop before, but now I am trying to be independent from using laptop by using microcontrollers.
Since I have to amplify the sound of tiny ants, I have more gain amplification than normal uses.
This is how I am trying lay things out for now
I was thinking of making a decent PCB, but I might try using multiple perfboards, connecting then together.
Daisy Seed is a microcontroller component that can do audio synthesis stuff
@harsh gust you may find that simply twisting together the pair of wires for each piezo element helps a bit to reduce the hum
ahhh thank you! I might prolly try using audio cable like I did before
I'm not sure what you mean by that, but you can just twist the pair of wires coming from the piezo element and see if it helps
i had an idea recently, about why my audio might be sounding like crap, maybe i'm clipping in the analog domain?
what is the typical voltage range, for analog line-level audio?
ok so that's how I am testing it rn.
There were two problems.
-
Power distributer that doesn't work properly with any components, under whatever setup.
-
using weird cable for audio components.
a quick google, says 1v,
and my old scope traces, show i was getting about 1v peak2peak, so maybe that wasnt the issue?
though, wikipedia says pro and consumer have different line levels, fun!
So, success?
uhhh I guess!? for now! Thank you so so much!!
Your project is very cool. I’m looking forward to hearing the final output!
ohh thank you so much dude!!
Hopefully this is an acceptable place to post this, but my 2014 volt has a pretty nice speaker system except that it's starting to fuzz out. I have limited experiences with car audio shops, but none of those experiences have even remotely approached a positive experience. How difficult is it really to replace your own car speaker system? I am more than comfortable with electricity and electronics, I'm just wondering about things I'm not familiar with such as working on a car extensively
It's not too tough: the connections are just push-on spade lugs in most cases, so you remove the existing speaker, unplug the wires, connect them to the replacement speaker, and place it back where the original was.
The Crutchfield website has lots of information and diagrams on doing this.
Ahoy out there, anyone good with USB audio ?
I have an interesting use case , that I need a little direction with
Here's the situation - I'm a bit old school so I like old school Motorola microphones , the big ugly white ones you used to see in cop cars. Anywho, I'm playing some simulator games in which there are 'radios' that ar used to talk to other players. Normally this is done with a USB headset, but for some fun and authenticity I looked into using the old hand held microphone CB-style.
Now there are people who sell 'button boxes ' that have an interface pre made for standard 4 pin microphones, but they are $300+
I've seen some home made ad-hoc systems that use a single board system ( arduino, etc ) to act as a USB keyboard to send a keypress to activate the PTT feature, and use a standard 1/8" plug connected to the MIC in on the sound card.
I have also seen some sweet high end systems that use only a USB connector , but those again $300 + for some off reason
as I see it, it should be able to be done with two single board microcopntrollers - one for the keypress, one for taking analog audio from the mic to digital and presenting itself as a USB audio device, and those two connected to a USB hub so that it only takes up one port
so am I crazy for thinking that I can take audio from a mic, , use an analog -> digital on board chip ( arduino, pi, etc ) and using USB OTG have it identify itself to the PC runnign windows as an audio device ?
(probably advanced stuff. Idk if that's easily possible with arduino. Can't a single device have multiple endpoints? I think Arduino HID can have multiple endpoints to present itself as both a keyboard and a mouse. So maybe it's also possible to have it present itself as both a USB microphone and a keyboard)
Taht was a question I ahd as well - if a single device can have multiple endpoints
Example of commercial pre-built interface / button box : https://www.simpanel.com/ats
IVe been googling / youtubing all night on this
I think this means that my Xbox one controller (connected over USB) presents itself as a HID input, a pair of headphones and a microphone
But I'm very sorry, I can't help you if doing that with an arduino or similar is super easy or super hard. I'm curious about that as well
Huzzah! Yeah I an do the keyboard part, but I'm unsure of the audio
The only USB audio library for Arduino that I know of is on the Teensy. Theoretically USB audio should be possible on RP2040. Waveshare has a uf2 that turns the RP2040 into a USB sound card (but output over I2S only), and there is absolutely no source code for it.
I"ll use wahtever hardware, I was just guessing
but I am really curious if you cna use a single USB as multip devices, I read somewhere that shaid no, to use a hub
this from https://www.pjrc.com/teensy/gui/index.html?info=AudioInputUSB looks promising to me
Hi all I think the answer to this question is No, from what I've googled, but thought I would check. Is there any Arduino or clone that supports 2 HID ports rather than 1? i.e. is there any Arduino compatible device that can run Mouse and Keyboard libraries and Joystick library, with 2 usb connectors, to emulate multiple HIDs? I'm looking at p...
it isnt clear on how, I'm more of a pi person than arduino .. I like micropython
it seems the majority of the solutions use 2 lines, one for audio ( 1/8" ) and a USB
If you can just plug the microphone into your PC's microphone jack and use a separate MCU that only does HID for the button, that's the easiest way I bet
I jsut saw that unit with the single USB and I want to nkow how they did it 🙂
it just looks to me like it's a single board doing keyboard press emulation and USB audio in one unit
I would assume similar as my xbox controller
Or does it actually send the PTT button to the PC? Or does it just mute/unmute the microphone based on that button? (and sends silence to the PC when it's muted)
all the ones Ive seen send a predetermined keypress
ah, there is a "usbHID.zip" - sounds like USB HID 😆
Question/problem:
I have a project where I am building a small circular device which has a speaker in it. Naturally I am going for a circular speaker.
The problem I have is that the top surface of the product "might" get wet by water/rain sometimes. So Ideally I have to make it water/splashproof.
How would I handle this with the speaker? I can't just leave holes at the top
Maybe I can have it facing to the floor with some rubber feet at the bottom? But that might not be great for the audio either?
I don’t know that the “right” answer is but I would approach it by using a waterproof speaker element and having it be the dividing line between “exposed to water” and “fully enclosed”. Then you can just have speaker holes on the top if you wanted 😀. And gasketed plugs for other holes like power & line-in. Some waterproof speaker elements: https://www.mouser.com/c/electromechanical/audio-devices/speakers-transducers/?impedance=8 Ohms&type=Waterproof
Ah interesting - thanks! Will have a look at those
Speakers firing down work just fine, I have a few
Thos look nice.
Hoi, does adafruit have a amp module for 3 wire speakers? As i have a iphone 13 pro speaker module here, but it needs 3 wires/3 prong, and my phone could output some, but not nearly enough power, so need a tiny amp to plug the speakers to. Any suggestions?
What sort of db range should I expect to get from a PAM8302 amplifier and an 8ohm 1watt speaker? I'm working on the finishing touches for my kid's halloween costume and it seems to peak around 70db. Wondering if I shouldn't expect much higher than that, and/or if a different speaker would be louder.
Do you mean it's stereo (2 signals + common ground)? Do you have a link?
have you tried looking at waveforms of the audio files you're using to see how loud they are? You could adjust their volumes in Audacity
doesn't seem to have an effect when I amplify in audacity
is it one of our speakers? which one?
not expecting miracles from it, just wondering if a different speaker would change anything or if I'm limited by the amplifier
I also have the speaker in a housing to focus the audio, but that only helps a tiny bit
(also confirmed the trim pot on the amp is all the way up)
I have a 5cm 4Ohm speaker with a 3W I2S amp and at full volume it's WAY too loud.
2.5W at 4Ω, 10% THD, 1.5W at 8Ω, 10% THD,
That amp has more power with a 4 Ohm speaker than with an 8 Ohm one
hrm, ok
time to see if I can cannibalize one of my kid's "way too loud" toys for a bigger speaker 😄
That speaker will also be louder if you put it in a baffle or enclosure
you know, if you ever thought to yourself "hm, I bet my old gen1 Echo Dot would have a speaker I can repurpose"
let me be the one to say that no, it doesn't
the "speaker" is basically a pair of tiny things that cannot easily be accessed/repurposed
not entirely a wasted effort though! I can desolder the rotary encoder it uses and add that to my collection
https://www.replacebase.co.uk/genuine-apple-iphone-13-pro-replacement-loud-speaker-module-original-reclaimed This is what i plan to amp up/provide the proper amount of cables to function
is this an amp, or just a speaker?
that's the iphone 13 pro speaker itself which i need an amp for.
the 2 larger tabs gives music, but is missing the bottom smaller one i think as i can ear music, but no vocals, that's drowned.
As if there's "3 speakers", left, right and center
Unless third is ground
I would assume that the speaker setup is special, and the frequency reponse might not be flat at all. I thought maybe you were talking about a more conventional speaker like https://www.adafruit.com/product/1313
don't have to buy from us, these kind of things are common
Aye. Reason i want iphone speaker is because it packs one helluva punch at proper volume and amps for it's small size. So i wanted to make a phone case with just that. But neeeed an amp to properly power it. Unless a regular small compute board can provide the volts/amps needed to properly power/wire it
If you's have the parts needed, i'd buy those :P
no, you need an amp, but I'm saying the size constraints may make it not flat at all. The amplifier in the phone (or the software) may do a lot of tailoring to match the speakers
Just first need to find out if it simply works with left, right, ground, or some other purpose for the third to function
yeah, I have no idea of the connections on it. ... going afk
Aye. That's why i need an external one. As it will be battery powered and connected over BT. Just need to know what components i'd need to make it all work
No worries :) But main question was if adafruit has a amp module that can connect 3 wires to a speaker. left, right, ground, or left, right, center for example.
If not, i shall dig more on the web 
sorry, the stereo amps here are bridge-tied, so you can't tie one side of the outputs together
what does that mean?
Many amplifiers produce more power by driving one output up while driving the other output down, so the difference between them is greater. Because of this, you can't just tie outputs from different amplifiers together because they'll fight.
You can sometimes connect current feedback amplifier outputs in parallel.
It means you can't drive two speakers with just three wires, where one is common to both speakers. For bridge-tied stereo amplifiers, you need four wires.
I'd like to revisit your choice of speakers. The way phone speakers sound so loud is that they cut off low frequencies. See various explanations here: https://www.google.com/search?q=how+are+phone+speakers+so+loud
If you are not totally committed to using those speakers, I'd suggest you get some more conventional, larger speakers.
that's the thing. This is iphone 13 pro speakers. They pack a heck of a punch and exactly why i bought them
(oh, so even "downstairs" is a nono word, wow.)
Unless you know of alternative tiny 2 wire only speakers that is as small, or close enough to be as strongly packed on bass/middle tone/highs as iphone pro speakers
I was originally going for ipad pro speakers as they pack an even tighter bass, but figured they would end up too big lol
Hi! I've been making slow progress on a music box for my daughter, loosely based on this idea: https://www.instructables.com/Juuke-a-RFID-Music-Player-for-Elderly-and-Kids/
After success with the original, I'm trying to make a v2 that's battery powered. I'm currently trying to do that with an Adafruit Feather RP2040, an Adafruit MusicMaker FeatherWing, and an MFRC522 RFID reader. I've been having trouble getting music playback and RFID reading to work at the same time, and although I'm comfortable with programming and debugging, I'm lacking experience in electronics and their communication protocols. The errors I get seem nondeterministic, and I can't tell if it's a hardware problem, a compatibility problem, a software problem, or a me problem.
I've gotten good help from Discords and forums in the past, but given my limited time for working on this proejct, it's hard to build momentum, and I find myself having to re-solve the same problems each time before making progress. Would anyone be interested in helping out 1-on-1 on a video call? I'd be willing to pay for your time.
Please @-mention or dm me if interested so I see the notification
how would one play an audio sample with an arduino, that is able to sustain as long as an input is high?
Should the sample be split into three bits, and just loop to test to see if the input is still high and repeat the middle bit over and over?
there are some audio processing tricks that you can do to "simulate" louder bass than the speaker can actually produce
Ain't gonna simulate anything. Just need a amp chip that can read from a speaker's 3 points :P The audio delivered to the speaker will be doing the EQ to make the sound how i want it 
That sounds like a good approach if your sound has an attack transient and a tail. Some audio libraries will let you specify loop points in a sample but then you’re in a whole audio library
Phone speaker drivers do the simulation to make fake bass. There's no magic in Apple speakers.
But still. Whenever i play a song through the 2 connectors, i can hear the song, but no vocalist. As i said, as if there's "middle speaker missing", That's the part i wanted to find out, if there was a amp that could supply for a "3 wire speaker" :P If i can figure out that part, i can work out the rest myself. I'm experimenting after all. just need to find a amp/chip that can supply audio to said "configuration"
Have you connected your current amp to the other two "maybe middle speaker" connectors as well? Just as a test if there actually is that middle speaker. Maybe then you hear only the vocals.
Yes, such amplifiers do exist.
Got a name/model for it? As i have no idea what to get.
Hm got a problem with audio conversion again
I am trying to batch convert mp3 to wav. I used "Kabuu Audio Converter" for that now. But my rp2040 does not seem to be able to play them
When I import to audacity it looks ok?
This is a stab in the dark, but I think you may be experiencing Phase Issues. Sorry this is a little long:
I’ve read through the other replies to your question, and forgive me if I missed it, but nobody seems to have picked up on the part about just the vocals being missing.
As far as I know, you are dealing with a stereo speaker. There is no mysterious third channel, and the music you are playing almost certainly has no separate vocal track.
So how can the vocals disappear from the music?
Phase.
In most music, the vocal track is recorded in mono and mixed to the center, meaning it goes to the right and left channel (mostly) evenly. The instruments are often spread differently in the right and left channels.
If the left and right channel are out of phase (meaning the voltage on one channel goes up when the other channel goes down) and get combined (in software, or in the amp, or in the wiring the speaker), the result will be the cancellation of any signal that’s the same in both the left and right channel.
Result: you’ll hear music but no vocals.
Im not familiar with the hardware you’re using so I can’t help with what to buy, but maybe my observation can shed some light on the nature of the problem.
Also: after thinking about this for a moment-
Are you maybe trying to drive one speaker by supplying it’s two terminals with the left and right signals? If so, you’d only be hearing the difference between the signals.
You should be able to get mono audio by supplying just the right or left channel to one speaker terminal, and ground to the other.
Hmm, so in this case it's just 2 wires needed, but as the singular iphone speaker is too demanding and needing an amp, the phase are out of whack and an amp could solve this issue? :) so with the adafruit 2.5w or was it 3 watt should suffice, right? And how will it be powered? Gonna find a few videos how to set it all up to test with. And a smol compute unit to BT receive it all and powered by a small rechargeable battery
Yeah, that's exactly how the old "vocal zapper" worked.
ive been bored, and rigged up gnuradio to render a waterfall of all audio i'm playing
and ive noticed a weird notch at around 6.6khz on some music, anybody happen to have a guess as to what could cause that?
but on closer inspection, i notice gnuradio was capturing at 44.1khz
but the rest of the pulseaudio stuff was in 48khz
so i assume PA was having to do rate conversion, which adds more artifacts....
but the 6.6khz notch is still present
My first thought was "Copyguard", but happily that never went anywhere.
new problem/question.
I am using this board for my project - works fine so far with my code.
https://www.adafruit.com/product/5768
I would like for the user to upload/remote trigger some audio files. I assume bluetooth would be the best option? Is that possible somehow? Is there a board that has bluetooth already integrated? Or would I have to use a separate breakout board for that?
The Adafruit Feather series gives you lots of options for a small, portable, rechargeable microcontroller board. By picking a feather and stacking on a FeatherWing you can create advanced ...
If you're using CircuitPython, the nRF boards are the ones that work with Bluetooth: https://www.adafruit.com/search?q=nrf52840 (I don't know if it's possible, but those are the Bluetooth boards)
For those I would then need an extra audio amplifier, right?
just made an interesting discovery with my headset mic
it has a lot of white noise, from 0 to 7khz
high noise floor?
but also, it seems to be running on a 14khz sample rate internally
it can register a 7khz tone, but an 8khz tone is just missing
but the usb interface lies, and claims it can do 48khz sample rate
so it must be up-sampling, to suit what the PC asked for?
interesting, while watching game of thrones, i noticed 2 notches
but they sometimes move
maybe its a defect in each mic they are using?
and when they switch mics in editing, it changes the pattern
and yeah, its entirely gone in the next scene, set in a different location
HDCP? It's in-band. But if it was active I would expect the entire stream to look like noise.
HDCP is more about XOR'ing a PRNG stream into the hdmi link
but this is just an h264/ac3 file, so all of the copy protection is missing
HDCP acts on the raw uncompressed data stream
Could be some sort of in-band metadata or control channel as well.
More likely, it's a defect in the compression or signal chain
thats what i'm thinking
and each clip of the original audio was captured on diff hw
and then in editing, combined into one final cut
Even more so if they're doing matrixing
matrixing?
Mixing down multichannel audio into 2-channel
There are several ways to mix down to 2 channels, with varying side effects
pulseaudio claims mpv is passing it:
Format: pcm, format.sample_format = "\"float32le\"" format.rate = "48000" format.channels = "6" format.channel_map = "\"front-left,front-right,front-center,lfe,side-left,side-right\""
so its pulseaudio that is responsible for the downmixing
I doubt it's trying to do center channel synthesis, Dolby encoding, etc. at least
but gnuradio is capturing at Sample Specification: s32le 1ch 48000Hz
so PA has to down-mix it all the way to single-channel
i have seen one show, where they botched the editing, and the left/right where 180 degrees out of phase
so when you mixed it down to 1 channel, all of the dialog vanished, lol
Hah, the old "vocal zapper" effect
That can also happen in some forms of stereo encoding, where the "left" channel is really L+R and the "right" channel is L-R (FM stereo works like this)
and i think that FM does this, so its backwards compatible with mono FM?
Yeah
ive not noticed those 2 notches show up again so far
I keep thinking of Copyguard and being glad the legislators had a clue and didn't go ahead with it.
how did it work?
ive also noticed, audio compression seems to dynamically change the max freq
there seems to be a sharp edge to the noise floor
interesting, it just cut to the next scene, a very sharp 16khz tone is now present
Basically, the proposal was to have a notch removed from copyrighted music, and they'd require recorders to refuse to record such material. The originators insisted the notch was narrow enough to be inaudible. The audiophiles insisted it would be audible. So the legislators had them do an A/B test. It was audible, and the proposal didn't continue.
and you can see how the noise floor stops at 18khz, but it sometimes goes beyond
ah, so if an audio sample has an abnormal notch at some freq, then the recorder just says no
Heh, that looks like old MP3 encoding sometimes did. It seemed like it figured that most high frequency material was barely audible, so it treated it as "there" or "not there", and on playback, it would insert high frequency beeping (which I privately dubbed "deedling") when it was "there". I have enough high frequency hearing that I could easily tell when it was doing it.
That is flat out evil.
Yeah, they'd chosen the notch to not be on the standard musical scale, but it happened to be a harmonic of B-flat, so was audible in orchestral music in some keys.
happen to remember the exact freq it was at? how wide it was?
Also if you ask me copy protection should have precisely zero legal standing beyond basic copyright law.
In the final test, they had tried to "improve" it by only notching when it was above -20dB, which made it even more audible as you could hear it coming and going with the sound level.
that reminds me, if twitch has a high offset (due to lag), it will adjust the playback speed to try and catch up
that really messes with music, i can hear it going off-key
there was a few drum beats, and it went past the normal max freq
Personally I'd be perfectly happy if copy protection was illegal, but that's never going to happen. So at the very least it needs to have no legal protection.
at least with things like HDCP, its not harming the quality of the audio, but it can intefere with your ability to playback
3840Hz, it was supposed to be fairly narrow. https://www.govinfo.gov/content/pkg/GOVPUB-C13-603f9bbbc03d6724d883563c14f4d78a/pdf/GOVPUB-C13-603f9bbbc03d6724d883563c14f4d78a.pdf
ah, that wouldnt explain the 6khz notch i saw before
HDCP is stupid, but less objectionable than some of the other "solutions" to the "problem".
ah, h-sync?
My old plasma monitor didn't support the more recent versions of HDCP, so certain devices stopped working after a firmware upgrade. I ended up buying an HDCP stripper from a part of the world that is uninterested in US company profits so I could still watch my legally obtained content in a legitimate fashion.
I also have a DVD player that lets me skip ads, FBI warnings, etc.
When it is more difficult to obtain the thing illegally than it is to pirate it, piracy is not the problem.
I'm guessing you meant "legally"...
looked again, its at about 16.39khz
while that reddit link is 15.7
ntsc vs pal?
google says ntsc is 15.750
pal is 15.626
in my case, i group-watch shows with friends often
case 1: would you say its legal for 2 people to sit on a couch, and watch a legally purchased dvd?
I would say so.
now, lets say that the 2nd person is half way across the continent
how do we watch the show together?
the simplest option ive found, is to shove a digital copy of the episode into https://syncplay.pl/
but now, how do i get that digital copy?
or, are we just not allowed to watch the same show?
Well, if these companies get their way, it's super convenient:
- Both of you pay separate subscriptions for your own accounts.
- Also pay for the Ultra Premium Deluxe Plus upgrade that supports RealLive room sharing.
- Add your friend as a friend on your account, and wait for them to accept the request.
- Create a virtual "room" and invite your friend into it.
- Your friend joins the room.
- Find out that you can't actually watch the thing regardless, because your friend is in a different region, and the thing is unavailable in that region.
Normally, copyrighted material is for "private exhibition". Generally, people you know, you can't charge admission, and it can't be re-recorded. As for the particular use case, that could be problematic, beyond your somewhat peculiar definition of "watching together"
... except for that time Disney literally tried to track your eyes in your living room to make sure too many people weren't watching the thing.
One time, I wanted to show Apollo 13 in the big conference room at work, complete with a serious sound system. Initially, the legal department said I wasn't allowed to do so. I went over the terms of "private exhibition" with them, and they conceded that my idea didn't violate that, so we hauled in the sound system, fired up the projector, and a few of us watched it on the big screen, until the scene where the Saturn V launches. We literally shook the building, and people came running to see what was going on, and stuck around to watch the rest of the film. Good times.
i know somebody that purchased the original film stock of some apollo stuff, scanned it, and uploaded it to youtube for archival
it then got copyright claimed, lol
Track my eyes in my living room? With WHAT? There's nothing in my living room capable of that.
only a tv with built in eye tracking is allowed to play disney content
problem solved 😛
Relatedly, I wonder how that free TV company is doing
that reminds me
i saw a chrome extension a few months back called tenami
its for youtube/twitch streamers to watch a show with the viewers
it will open a streaming site like netflix, and use the extension to forcibly pause/seek, to keep everyone in sync
it also opens 3 popup windows, for the show, twitch stream, and twitch chat
and tries to move them to line up nicely
linux window decorations arent accounted for
and it moves all the windows, on every tick, roaming all over the screen 😛
Ah yes, copyright claiming public domain material is a classic.
ive also seen another problem
news stations uploading news clips to youtube, and checking a box that automatically enters the clip as "owned by the news station"
then the news station clips a youtuber
and the original creator gets a copyright strike!
There seriously needs to be a penalty for that type of thing.
I don't see how such a penalty would benefit rich old white guys
👉 DMCA takedown: https://github.com/github/dmca/blob/master/2023/10/2023-10-10-mazda.md
🔵 https://www.thedrive.com/news/mazda-slaps-developer-with-cease-and-desist-for-diy-smart-home-integration
🔵 https://web.archive.org/web/20231014070536/https://old.reddit.com/r/homeassistant/comments/1771ywu/removal_of_mazda_connected_services_integration/
🔵...
basically, it was a home-assistant plugin, that could alert you if the car windows are open and its going to rain
Yeah I heard about that.
its using endpoints on a publicly accessible service
mazda claims the android app was decompiled to find them
Even then, decompilation and reverse engineering are not illegal.
That's good, as service documentation for this old oscilloscope is hard to come by
The EULA may have rules against it, but what if I never actually agreed to those terms?
that reminds me, what kind of EULA is involved with the rpi firmware?
what if i have never owned a certain model of pi, and am decompiling firmware for that model
Although it doesn't take much in the way of reverse engineering to realize that 6AN8 tube needs replacing
cant clearly see anything wrong with that one
That bluish glow inside it indicates that the tube has gone gassy
No idea. But so-called "shrinkwrap licenses" are illegal in the US, so just owning a Pi doesn't necessarily subject you to the terms and conditions of the firmware.
Fair point. It's clearer from this angle, but I can see how it might look like it's reflected from something nearby
That reminds me I need to fix my tube tester.
the rpi engineers are also aware of what ive been doing, and havent really told me to stop
most recently, one of them said:
The problem with getting your answers by decompiling the code is that there's just enough truth to confuse people with a plausible but wrong explanation.
in response to me just doing a readelf -l
that wasnt even decompiling, lol
Oh, the engineers are probably happy to see you doing it. It's just the legal team that would complain.
firmware wise, the pi5 is a bit of a mixed bag
the firmware is doing far less
but they have also added new blobs for other tasks
i think overall, the blobs are just managing clocks, reset and power logic
I was working on reverse engineering Pioneer's LaserBarcode system but I was having issues figuring out the checksum field, so I wrote them and asked. They wrote back saying it was too hard and to give up. I explained what I'd figured out so far, and they said they'd give me a free copy of their $100 software if I promised not to publish my findings!
lol
It turned out their software was written in ... HyperCard!
havent heard of that one
It's fairly primitive, basically "cards" (like web pages) with information on them, with links (like web pages) to other cards to do various things.
Video highlighting my research on PowerPoint Turing Machines for CMU's SIGBOVIK 2017
Read the paper:
http://tomwildenhain.com/PowerPointTM/Paper.pdf
Download the TM:
http://tomwildenhain.com/PowerPointTM/PowerPointTM.pptx
Original video (without live background noise):
https://youtu.be/sdkxWqsk17c
Please check out my other videos for (slight...
sounds like this? lol
Kinda the opposite
oh, and another major firmware difference
pi0-pi400, the user needed to include blobs on the SD card for the system to boot normally
so the distro maintainers needed some kind of permission to copy those, and include them in disk images
pi5 however, all of the blobs are on SPI in the board
the disk images can be blob free (though, wifi/bt still wants more)
I'm using an arduino to spit out a sinewave
by default, that means my voltage is 0-5v centered at 2.5v
i want it to be, a proper audio signal, so i need to "shift" it down by 2.5v
I'm testing in ltspice and it seems that i can literally just slap a 0.1uf cap on the output pin and get a nice +-2.5v signal centered on 0v
am I missing something? this seems too easy.
thats what i would do as well
just note, the value of the capacitor will likely impact what frequency ranges can pass thru it