Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Maximite - high quality audio
Author | Message | ||||
mookster1 Regular Member Joined: 10/06/2011 Location: New ZealandPosts: 81 |
I had an idea and I want to know if you guys think it will work. It involves using the sound output to send high-speed digital sound data to a DAC (with a serial-in/parallel-out chip in front of it) to have high-quality (not monophonic square wave) sound, loaded as say a WAV file off an SD card for instance. To my understanding, the sound/PWM output can output a signal at 200KHz? This means 5us pulses, so for a sample size of 8 bits this allows for a sample rate of 25000 samples/sec, decent enough for MIDI style stuff. What could I use to supply a 200kHz clock(in sync with the data) so the SIPO latch can reset itself after 8 bits/a sample? Cheers Capacitance is futile - roll on 2012! |
||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
mookster - I have had some ideas on this. I don't think a DAC would even be required, but the problem I have encountered is changing the duty cycle of the PWM output while handling the reading of sound data from SD card. Essentially the idea is to read a (possibly modified/simplified) WAV file from the SD card and then change the duty cycle of the PWM output (the PWM should be about 4 times faster than the sample rate) which then feeds a low-pass filter/amp. This will filter out the carrier wave signal. The theory is fine (I think), but getting MMBasic to output a steady (lets say 32 kHz) square wave while varying the duty cycle as bytes are continuously read from the SD card may be the challenge. MMBasic can easily output the desired carrier frequency. I have written a small test program to randomly change the duty cycle in a loop where the PWM is running at 32 kHz with duration of 0.5 m/sec and I get a nice white noise as output. Durations of less than 0.5 m/secs don't work with the PWM. Maybe I'm completely deluded and it can't be done, but I suspect there are some smart folks who can make it work. Cheers, crackerjack. |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
I have been thinking of adding a PLAYWAV "file" command that would load a WAV file and play it out the audio port using PWM as suggested by crackerjack. I have not thought out the details but it should work, it is finding the time that is difficult. Geoff Geoff Graham - http://geoffg.net |
||||
Raros Regular Member Joined: 06/02/2012 Location: ItalyPosts: 55 |
Hi I have tested it myself. With the audio output does not go: and 'a disaster. I tried the excellent BTC Sound Encoder 3.0 software free on site http://www.romanblack.com/picsound.htm I used 1.7 because the algorithm 'is the best speed on Maximite. See BTC Sound Compression Algorithm http://www.romanblack.com/btc_alg.htm I used two resistors and a capacitor to pins 1 and 2 of Maximite. Something feels .... I could put a LM358 to increase the volume. Examples: 10 ' Playback sound with BTC encoder 1.7 - PIU' VELOCE
12 ' New Bit Pin -> resistor value 1.33R -> is always output = 15k 14 ' Last Bit Pin -> resistor value 4R -> is always output = 47k 20 Cls 50 x=949:' num data 100 Dim a(x) 110 For t = 0 To x 120 Read a(t) 180 Next 185 pa=0.02 200 Setpin 1,8:Setpin 2,8: ' Pin 1=Last Bit : Pin 2=New Bit 300 for t = 0 to x 310 P128 = a(t) And 128:Pin(2) = P128:Pin(1) = P1 315 Pause pa 320 P64 = a(t) And 64:Pin(2) = P64:Pin(1) = P128 325 Pause pa 330 P32 = a(t) And 32:Pin(2) = P32:Pin(1) = P64 335 Pause pa 340 P16 = a(t) And 16:Pin(2) = P16:Pin(1) = P32 345 Pause pa 350 P8 = a(t) And 8:Pin(2) = P8:Pin(1) = P16 355 Pause pa 360 P4 = a(t) And 4:Pin(2) = P4:Pin(1) = P8 365 Pause pa 370 P2 = a(t) And 2:Pin(2) = P2:Pin(1) = P4 375 Pause pa 380 P1 = a(t) And 1:Pin(2) = P1:Pin(1) = P2 385 Pause pa 500 Next 510 ' 515 ' 520 ' 600 End 900 ' data 1000 DATA 220,075,084,091,221,128,031 1001 DATA ........ 1002 Here are some examples: Rockmon17-16_8000.bas Blackfire17-16-8000.bas Blackfire17-21-6000.bas Maximite3-17-16.bas 2012-03-14_073247_PlaySound.zip Come on Geoff I can not wait. If you can put even the VOLUME control: Do you remember the SAM Software Automatic Mouth? I'm working, I would like to convert MMBasic. In 80 years I have converted the C64 version for the VIC20 expanded with all the memory banks. It still works with WinVice!!!!! Raros. |
||||
cosmic frog Senior Member Joined: 09/02/2012 Location: United KingdomPosts: 284 |
Wow, this looks great Raros, I'll be building this circuit tomorrow and trying it out. Cannot wait. |
||||
mookster1 Regular Member Joined: 10/06/2011 Location: New ZealandPosts: 81 |
Hi all My initial idea was to just play two sounds at once by "swapping" between sounds every period of the sound but I figured that was just going to turn out messy. So then I thought about using PWM (8 bits all set would be 255 clock periods, 10010100 would have been 148 clock periods etc.) and feed it to the piezo somehow. However, this was not going to turn out wonderfully well because I would have needed some sort of timing circuit to turn this into proportional voltage (resistor-capacitor was my idea but I figured it wouldn't be too linear in its response...) and also it was going to have about a 700Hz sample rate for an 8-bit sample! So I figured why not go the whole hog and use it as high-speed serial and just have a DAC? Raros, your idea above is brilliant . I will try this out when I have some time Capacitance is futile - roll on 2012! |
||||
Print this page |