Digitalsound toolchain/demo from wav 2 Oric

This forum is about audio tools, including samplers, sound trackers, sound chip editors, how to do sound effects, etc...
Post Reply
User avatar
waskol
Flight Lieutenant
Posts: 407
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Digitalsound toolchain/demo from wav 2 Oric

Post by waskol »

I used for this a few tools from the ZX community, namely :
- sox.exe
- Sam2ay.exe
both extracted from wav2ay_src (you can find it here : http://www.worldofspectrum.org/pub/sinclair/tools/pc/ )

I used "digit.s" from dbug in its welcome sample little demo as a player.

look at the osdk_buid.bat to see how the sample.wav is converted to a sample.s file

Code: Select all

::
:: Converting from WAV to RAW...
::
echo Converting from WAV to RAW...
.\tools\sox sample.wav -r 11025 -b -u -c1 Output.raw


:: Converting from RAW to AY
::
echo Converting from RAW to AY
.\tools\sam2ay.exe

%OSDK%\bin\bin2txt -s1 -f2 -n16 Output.ay sample.s _Sample
I did this because It took me a lot of time to find a way to digitalize some .wav samples into Oric/AY8912, and it can be usefull to anyone.

The result quality depends on the original wav sample, and it is far from perfect but a good start to do better.
Attachments
DigitalSound.zip
(457.56 KiB) Downloaded 68 times

User avatar
Dbug
Site Admin
Posts: 3350
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Digitalsound toolchain/demo from wav 2 Oric

Post by Dbug »

Is this sam2ay doing things very different from what my SampleTweaker.exe does?

I used that for my Oric Tech demo:

Code: Select all

SET SAMPLETWEAKER=%OSDK%\Bin\SampleTweaker.exe

%SAMPLETWEAKER% data\Sample.raw build\files\BoomTschak.raw
%SAMPLETWEAKER% data\SampleDefence.raw build\files\SampleDefence.raw
%SAMPLETWEAKER% data\SampleForce.raw build\files\SampleForce.raw
%SAMPLETWEAKER% data\SampleHa.raw build\files\SampleHa.raw
%SAMPLETWEAKER% data\SampleYeah.raw build\files\SampleYeah.raw
%SAMPLETWEAKER% data\SampleChimeLoopStart.raw build\files\SampleChimeLoopStart.raw
%SAMPLETWEAKER% data\SampleChimeLoopEnd.raw build\files\SampleChimeLoopEnd.raw
%SAMPLETWEAKER% data\SampleMusicNonStop.raw build\files\SampleMusicNonStop.raw
%SAMPLETWEAKER% data\SampleTechnoPop.raw build\files\SampleTechnoPop.raw
http://miniserve.defence-force.org/view ... iew=markup

User avatar
waskol
Flight Lieutenant
Posts: 407
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Re: Digitalsound toolchain/demo from wav 2 Oric

Post by waskol »

Dbug wrote:
Sun Dec 01, 2019 8:42 am
Is this sam2ay doing things very different from what my SampleTweaker.exe does?
I missed your tool and I don't know why (I discover it !) !

Originally, sam2ay is just a littl pearl routine thatconvert 8-bit unsigned sample to AY volume levels

so, Is this sam2ay doing things very different from what my SampleTweaker.exe does? I don't know

Code: Select all

#!/usr/bin/perl -w
# convert 8-bit unsigned sample to AY levels

binmode STDIN;
binmode STDOUT;
while (!eof(STDIN)) {
	read(STDIN, $b, 1);
	$b = ord($b);
	if ($b < 2) {$lo = 0;}
	elsif ($b < 5) {$lo = 1;}
	elsif ($b < 7) {$lo = 2;}
	elsif ($b < 10) {$lo = 3;}
	elsif ($b < 14) {$lo = 4;}
	elsif ($b < 19) {$lo = 5;}
	elsif ($b < 29) {$lo = 6;}
	elsif ($b < 40) {$lo = 7;}
	elsif ($b < 56) {$lo = 8;}
	elsif ($b < 80) {$lo = 9;}
	elsif ($b < 103) {$lo = 10;}
	elsif ($b < 131) {$lo = 11;}
	elsif ($b < 161) {$lo = 12;}
	elsif ($b < 197) {$lo = 13;}
	elsif ($b < 236) {$lo = 14;}
	else {$lo = 15;}

	read(STDIN, $b, 1);
	$b = ord($b);
	if ($b < 2) {$hi = 0;}
	elsif ($b < 5) {$hi = 1;}
	elsif ($b < 7) {$hi = 2;}
	elsif ($b < 10) {$hi = 3;}
	elsif ($b < 14) {$hi = 4;}
	elsif ($b < 19) {$hi = 5;}
	elsif ($b < 29) {$hi = 6;}
	elsif ($b < 40) {$hi = 7;}
	elsif ($b < 56) {$hi = 8;}
	elsif ($b < 80) {$hi = 9;}
	elsif ($b < 103) {$hi = 10;}
	elsif ($b < 131) {$hi = 11;}
	elsif ($b < 161) {$hi = 12;}
	elsif ($b < 197) {$hi = 13;}
	elsif ($b < 236) {$hi = 14;}
	else {$hi = 15;}
	
	print chr(($hi << 4) + $lo);
}
Attachments
WAV2AY_SRC.zip
(515.56 KiB) Downloaded 58 times

User avatar
coco.oric
Squad Leader
Posts: 558
Joined: Tue Aug 11, 2009 9:50 am
Location: North of France
Contact:

Re: Digitalsound toolchain/demo from wav 2 Oric

Post by coco.oric »

I know what i can do these days off... trying to understand these different sounds format
Thanks waskol for that implementation
coco.oric as DidierV, CEO Member
Historic owner of Oric, Apple II, Atari ST, Amiga

Post Reply