ArduiTape

Page 3/9
1 | 2 | | 4 | 5 | 6 | 7 | 8

By hit9918

Prophet (2904)

hit9918's picture

01-10-2014, 10:05

who got 11khz to load? who got the 9600hz wav I posted not to load? I get 9600hz loaded all day over naked door bell wire.
WHERE does the 11khz figure come from? from soundblaster stoneage decades ago! it has nothing to do with the MSX.

take an audio app and look at the curves of the 9600hz wav I posted. It is like a PPI pin timing diagram.
at 2400 baud the PPI pin wiggles 9600 times per second. The PPI signal is 9600 DAC-rate-Hz.
Because tone-hz is 1/2 dac-rate-hz, in the analog corner you may find specs of 4800hz.

Then look at the 11khz wav of caslink2.
Look at the short slopes. One of their arms is halve as long as the other, bad timing. The rule "bigger hz is always better" doesnt work!
And that pattern doesnt look like a usual resampler, but a hand crafted pattern to fit in 11khz.
again, why was something hacked into 11khz, the reason was a soundblaster bias, not the MSX.

Now, to get this loaded you probably need some strong filter. And then because of that you need an amplifier.
I think that is the story of casette cables with special circuits. First create a false timing wav and then fix it with analog vooodo.
And then the whole thing has the tendency "it only ever loaded on the authors cable / on his particular MSX model".

Long after soundblaster DOS days, a wav encoder goes this way:
shannon nyquist say that if you resample, the minimum hz must be twice as big: 9600*2 = 19200hz.
however, the 9600hz wav is NO RESAMPLING. It is a 1:1 copy.
19200 vs 9600, what to pick... well you pick 9600.

note that 9600hz is not a magic number, but "hz = 4*baud" is the relevant formula. the values I told are about 2400 baud.
to make e.g. 3000 baud, do not resample, but just write 12000Hz into the header. 3000 baud * 4 -> 12000hz.
but the wav does not get bigger. no matter what, there is always one ppi state stored in 1 wav byte.
Ironicaly that elegant smallest wav also is the simplest code, no resampler, plain copy.

And then comes the second resampling step in the audio-replay device. That is the part that is actualy different to soundblaster stoneage.
There exists no 9600hz DAC. With resampling, minimum DAC rate is 19200Hz.
In 2014 audio devices realtime-resample to high-khz DAC hands down.
The audacity displays "9600Hz", I press start and the thing works.

if some stamp mark sized consumer device does make troubles, the wav tool keeps a standard resampler code around.
the user can enter a hz number. warn him that below 19200Hz is danger zone.
so then the wavs are bigger and on that cheap device you can store less stuff,
but while the whole thing still is about a casette cable that is a plain wire and a method to work with any MSX model.
because it has no odd timing that would ask messing with analog circuits.

@giangiacomo.zaffini
practice case, fix caslink2, my recommendations are:
simple code to create 9600hz wav. more precisely the "hz = 4*baud" wav. low hz wav is best coded in plain integer to be sure.
"rework to floating point", but not on the basis of 11khz. just a standard resampler code. to be used to create wavs above 19200hz.

also caslink2 has a replay feature. maybe that works with an old soundblaster API. but soundblaster did have 22khz. or maybe 44khz. pick the highest possible DAC rate.
and then again use the said resampler code to do the replay.
and then an ages old pentium hands down realtime-resamples to that high-khz DAC. who knows, maybe a 486 can do it.

lack of resampling code in the audio-replay is what made the 11khz story. is what put the 11khz bias in there.

@Buleste,
similar, "14400 loads better than 9600", to me it smells like a bug in the experiment.
for example the wav generator made hiccups on 9600hz. a resampler generated 1.001 wav samples per ppi state. While exactly 1 is needed.
the same resampler code may have worked perfect all day in a 44khz app, because there that kind of inaccuracy plays no role.

what is the rate of the replay DAC?
to cover high speed apps like e.g. 3000baud, that is 12000hz wav, that needs at least 24000hz DAC rate in the player.
a replayer should use 44khz if possible.
if the little cpu on the board cant do that speed, a more primitive resampling is better than linear interpolation resampling that drops below the 2*hz requirement.

By Buleste

Master (158)

Buleste's picture

01-10-2014, 12:19

No DAC what so ever. Using a Arduino Uno to play the wavs which is limited to a max sample rate of 20kHz (I'm trying to make this as cheap as possible and DACs are expensive). I have tested many games at 9600 rate and 14400 rate and 14400 rate works best. Feel free to look at the board and code to see if you can improve them. This is an open project but please do not add more hardware as it adds costs which defeats the aims of the project. Please note I have not tried your 9600 wav I have been testing games.

There is no custom cable as the standard 3.5mm white plug fits into the standard 3.5mm jack and the standard 2.5mm motor control lead fits into the standard 2.5mm jack. The project works on an Acorn Electron and a Toshiba HX10. I would like more people to build and test it on different 8-bit machines but that is not of interest to this forum.

Caslink2 is useless for me as it does not handle cas files so I do not use it at all. I use a modified cas2wav code to produce an output at 14400 Hz as this works best for 1200 baud and 2400 baud rates.

By giangiacomo.zaffini

Champion (267)

giangiacomo.zaffini's picture

01-10-2014, 13:41

@ hit9918: I'll do 9600Hz WAV sampling rate and I'll share code for sure!

By SadKen

Rookie (17)

SadKen's picture

01-10-2014, 13:46

Ooookay.... well first off... i'm the guy behind the coding, and there are a couple of things that need to be cleared up..

Firstly this is an all in one works for everything machine, which is the reason behind the WAV files. We're concentrating on the MSX at the moment because @Buleste is the only other person to build one so far, and that is the machine he's targeting. I however built mine to work with the Acorn Electron initially, and hopefully my C64 later.

The sample rate works best at 14400 because at 2400Baud it gives you a minimum of 3 data points of pcm data per generated waveform (as 2400baud uses a max frequency of 4800hz which gives you 3 data points per wave). The updated cas2wav program now kicks out a square wave, much like tapdancer, as the sine wave it originally kicked out doesn't work on modern PWM output equipment.

It is possible that in the future the Arduitape works directly from the .cas file instead of having to generate a wav file first, but as this was designed to be a universal machine that is on the back boiler until all the other bugs are ironed out.

There are plenty of other solutions out there if you have the money to throw at them, using a Raspberry PI would have given us easier directories, realtime .cas .tap etc file conversion, colour screens maybe even on screen manuals, and cover art, but it would have cost a lot more. Personally i paid £4 for my funduino nano, and probably only another £5-£10 for the other parts so although this might not be the prettiest or most elegant solution in the world, it's cheap, and it seems to work pretty well.

@hit9918 Not sure why we would need to resample the audio file, as all we're after is either a 1200hz or 2400hz waveform (or 2400hz and 4800hz in 2400baud). The machine only measures the frequency, and doesn't care about a nice smooth wave. Usually loading from tape watches for a transition across 0v and simply measures the time between each transition. This is partly the reason sine waves don't work without an expensive DAC as PWM doesn't give you a good enough transition when working with sine waves (even some laptops struggle with this one, as many only output PWM audio).

Think that's everything covered, all comments are welcome but try not to put people down for not doing things the way you would, as sometimes that isn't always the best way.

#rantover

By hit9918

Prophet (2904)

hit9918's picture

01-10-2014, 14:18

I just tried cas2wav of a castools-1.3 folder.
It makes nice sinuses at 43200hz.
At 9600hz exists no sinus. Hacking a code into a completely different world, random things can happen.
Like a crack every 1000 bits.

Again getting into some detail Smile
The cas2wav slopes look like a 0-bit is high high low low.
I thought it should be low low high high. That sheme I copied from openmsx casette emu, this way I sneaked past a dozen places where the polarization question pops up Smile

I wonder why it still loads.
Only thing I can imagine is that the bios counts just flips to the other side and polarization does not count.
But just speculating.

By hit9918

Prophet (2904)

hit9918's picture

01-10-2014, 14:23

@giangiacomo.zaffini, cool Smile

By hit9918

Prophet (2904)

hit9918's picture

01-10-2014, 14:36

One thing I no more like in my code is how in the end it makes smaller sample values.
They are about "prevent hanging load at the end".
I used it to see it in the curve, but full volume feels better.
For players who swallow the last bit of the file, it should maybe be a second long.

By Buleste

Master (158)

Buleste's picture

01-10-2014, 14:56

@hit9918 that is probably why 9600Hz does not work fully with cas2wav but as I said 14400 Hz works at 1200 baud and 2400 baud.

If you have a programme that converts cas files to wav files at a rate lower than 20kHz then I would love to test it at both 1200 and 2400 baud

By hit9918

Prophet (2904)

hit9918's picture

01-10-2014, 15:03

maybe you can find a way to mod it so it goes integer style.
the place where is generated a 0-bit and a 1-bit.
each bit makes 4 bytes in the wav.
I suggest looking at the curves in audio app. things repeat within exactly 4 samples.
the 0 is a long slope, the 1 is two short ones.

By Buleste

Master (158)

Buleste's picture

01-10-2014, 15:11

I don't need to mod it as it works on most cas files

Page 3/9
1 | 2 | | 4 | 5 | 6 | 7 | 8