News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_roudoudou

[tool] WAV melody to PSG conversion

Started by roudoudou, 16:35, 09 January 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

roudoudou

inspired from an MSX tool, here is a new tool to convert melody/speech/instrument to PSG frequencies
the tool use a WAV as input, you may select the number of channel, replay frequency, ...
it is possible to create a WAV preview of what you will get on a real CPC
the default output is a listing of register in CSV format, you may choose DMA-list to create an optimised almost ready to use DMA-list
joined to this thread a DSK for Amstrad Plus with some Street Fighter 2 sounds (17K of DMA for ONE MINUTE of speech, cries, ...)
i hope @Targhan will allow some integration with Arkos Tracker for SFX in games with music  :P
reference: https://msx.org/forum/development/cross-development/convert-wavmp3-psg-melody?page=0
sources in github: https://github.com/EdouardBERGE/wav2ay
My pronouns are RASM and ACE

gurneyh

#1
Great tool, great toy ! :)

Some tests on CPC old
https://rasmlive.amstrad.info/edit/zNAikaHwbFyp9yAe4
https://rasmlive.amstrad.info/edit/aqXEnH33qYPqmrKmw

click on the emulator window to play the sound.

Targhan

Very interesting! This could replace some samples in music, or create a new kind of SFX, with the same amount of CPU (but slighly more memory).
I could integrate this to AT2, but not short-term (unless some people urge me to).
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

GUNHED

Thanks a lot! Saves me the work of doing it, had a similar idea.  :laugh:
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

roudoudou

Quote from: Targhan on 19:12, 09 January 21
Very interesting! This could replace some samples in music, or create a new kind of SFX, with the same amount of CPU (but slighly more memory).
I could integrate this to AT2, but not short-term (unless some people urge me to).

My pronouns are RASM and ACE

roudoudou

New release v1.2
audio glitches bugfixes >:(
experimental support of noise register :o
optimised for size CPC replay 8)
AKI instrument export :-* 
note: this tool is intended to be used by AY power user

https://github.com/EdouardBERGE/wav2ay/releases/tag/v1.2
My pronouns are RASM and ACE

GUNHED

The holy grail of CPC music!  :) :) :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

SpDizzy

Thanks so much Edouard for this wonderful tool.

Been toying around for a while with parameters on various input files getting great results on output .wav files.

However, cause I'm using the great Arkos Traker 2 to play music and effects, I wonder:

- Is by chance any possibility to have an output as .aks to use directly on AT2?

As .aki format is limited to 64 lists, even a small speech of 0.25 secs failed to open when tweeking with some parameters for better fidelity with source ('tresh', 'high /low'), chrashing AT2 in the attempt.

I don't want to renounce using AT2 for my productions/tests, so:

- Could be 'dmalist' output data compatible in any way with AT2 .akx output to be used with any AT2 player?

Using 'cpclist' as output I'm in need of a new player as in 'replay_cpc.asm' example, but I even can't get it working because some includes/dependencies are missing like 'ultrasyd_C713.bin'.

Thanks so much both @roudoudou and @Targhan for your time and dedication.



roudoudou

this is an example of code, the ultrasyd.bin is a compiled music i used for my tests, just replace the bin with your compiled music or a RET instruction if you do not had one
the player is a proof that the music can be stopped, then sample played, then music continue
if you are a bit lost, i can help you, (maybe mail or discord?)
for AKS it's a non optimal solution for samples, my player use its own packed format
cheers
My pronouns are RASM and ACE

SpDizzy

Wow, that was really a quick response!

Looking in deept at the code now, I can understand how it works (besides I'm not good at all understanding PSG stuff).
So that packed format for the player is just the '-cpclist' output from wav2ay conversion?

PD: I thought 'sample.cpc' was indeed the music. I was terribly clueless. Sorry for the mistake about that. God bless Ultrasyd and all his legacy. A talent of other world.

roudoudou

Quote from: SpDizzy on 20:42, 17 February 24Wow, that was really a quick response!

Looking in deept at the code now, I can understand how it works (besides I'm not good at all understanding PSG stuff).
So that packed format for the player is just the '-cpclist' output from wav2ay conversion?

PD: I thought 'sample.cpc' was indeed the music. I was terribly clueless. Sorry for the mistake about that. God bless Ultrasyd and all his legacy. A talent of other world.

correct :)

some samples needs to be fine tuned where there is noise involved

as an example, this is the "eight" of Street Fighter 2, i wanted to add some noise in the final "T"

i add +2 to the first value (descriptor) and i add a value at the end of the line (typically 0 for opening noise all channels or #38 to shutdown noise)

once you know that, you can also remove noise when it's wrongly automatically added by the algo!


defb 27 ; nombre d'iterations
defb #FC,#04,#00,#9D,#07,#00,#7B,#04,#00,#66 ;  157-04  123-07  102-04
defb #88,#09,#8C,#69,#07,#24 ;  140-09  105-07    36-07
defb #A8,#0C,#7D,#08,#77,#09,#23 ;  125-12  119-08    35-09
defb #A8,#0A,#7E,#0C,#70,#0A,#23 ;  126-10  112-12    35-10
defb #E8,#08,#01,#25,#0D,#91,#0B,#24 ;  293-08  145-13    36-11
defb #E8,#0E,#00,#84,#0A,#22,#0A,#21 ;  132-14    34-10    33-10
defb #88,#09,#F4,#83,#0F,#7D ;  244-09  131-10  125-15
defb #A8,#0B,#7F,#0D,#70,#0A,#20 ;  127-11  112-13    32-10
defb #A0,#09,#7D,#0C,#6D,#1F ;  125-09  109-12    31-10
defb #A8,#0A,#DB,#0B,#6C,#09,#1E ;  219-10  108-11    30-09
defb #20,#DF,#0C,#6E,#1B ;  223-10  110-12    27-09
defb #20,#E2,#0A,#72,#1C ;  226-10  114-10    28-09
defb #A8,#0B,#F1,#08,#76,#0B,#1D ;  241-11  118-08    29-11
defb #A8,#0C,#FB,#0A,#7C,#07,#1F ;  251-12  124-10    31-07
defb #E8,#0B,#01,#08,#09,#80,#08,#1C ;  264-11  128-09    28-08
defb #88,#0A,#0F,#89,#07,#83 ;  271-10  137-09  131-07
defb #A8,#09,#1C,#08,#90,#05,#1C ;  284-09  144-08    28-05
defb #A0,#08,#3E,#07,#96,#1B ;  318-08  150-07    27-05
defb #A8,#06,#61,#03,#90,#00,#1B ;  353-06  144-03    27-00
defb #A0,#03,#B3,#00,#90,#1B ;  435-03  144-00    27-00
defb #80,#02,#78,#90,#1B ;  376-02  144-00    27-00
defb #80,#00,#78,#90,#1B ;  376-00  144-00    27-00
defb #00
defb #00
defb #00
defb #A8+2,#0A,#13,#0A,#88,#0A,#69,0 ;  275-03  136-02  105-02  Add noise
defb #A8+2,#09,#13,#09,#88,#09,#69,#38 ;  275-00  136-00  105-00 Remove noise

My pronouns are RASM and ACE

SpDizzy

Quotesome samples needs to be fine tuned where there is noise involved
Thanks so much @roudoudou for detailled info, will take it into account for fine tune.

What I still missing is how to create that compiled music (music with initialisation code).

If we take as example the sample "Fight" of Street Fighter, all we have is raw optimised list of values for the music, obtained as output with '-cpclist' option.

So first call to #C000 for initialise music (where music data is absolutely positioned) will get just 'random' values in there for a joyfull crash, not opcodes.

org #4000
run #4000
di

xor a
ld hl,#C713
call #C000 ; init de la musique

So, is it possible to know how that initialisation code looks like? Can't access 'ultrasyd_C713.bin' to take a look.

Thanks so much.

roudoudou

Quote from: SpDizzy on 23:22, 17 February 24What I still missing is how to create that compiled music (music with initialisation code).
oh, i thought it was obvious, sorry!

the compiled music stands for songs of any tracker (Arkos, Starkos, SoundTracker), this is not related to my tool. Only to demonstrate that my sample replay can stop any replay

the ultrasid bin is "default" song provided with Arkos Tracker 2 in directory songs/STarKos of AT2 (i used Fractals because it's louuuuuud)

if you export song as AKG or AKY, both players use "hooks" => that means there is 3 jump at the begining, the first for INIT, the second for PLAY and the third to STOP, this is compatible with old trackers and also when you want to try AKG or AKY with AT2, you keep the same CALL to #C000 / #C003 when compiled in #C000 disregarding the  player your are using. Is it clear?



My pronouns are RASM and ACE

SpDizzy

Damn!! It was really easy  :picard:
Perfectly clear, many many thanks!

Targhan

How many of you would be interested in an integration with Arkos Tracker? You'd drag'n'drop a WAV and it would automagically use Roudoudou's code to create a special instrument (not limited to any length) to use. I guess this could be used as a normal instrument in the patterns, but also as a sfx.

I'm still dubious to the quality of the samples (many tests I did were not very good), but I'd be happy to have my mind changed :).
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Prodatron

I didn't look at this before, but I would be very interested in it!

GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

trocoloco

Quote from: Targhan on 11:59, 18 February 24How many of you would be interested in an integration with Arkos Tracker? You'd drag'n'drop a WAV and it would automagically use Roudoudou's code to create a special instrument (not limited to any length) to use. I guess this could be used as a normal instrument in the patterns, but also as a sfx.

I'm still dubious to the quality of the samples (many tests I did were not very good), but I'd be happy to have my mind changed :).
That would be a nice feature, for synth sounds, lazer or even drums & perc would be great as instrument to experiment with, let alone for "samples"  in games

SpDizzy

#17
Really interested here of course!!  ;D It would be great to be used as an instrument without that lenght restriction, and marvellous to be exported as .akx

roudoudou

 @Targhan let me know if you need something for integration or anything else
My pronouns are RASM and ACE

Targhan

Thanks. I still need to be convinced about the sound quality. If you have wav of before/after samples, I would like to hear that.
Also, I notice in the command line that you can have 3-channel output. Is there a real benefit to this?
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

roudoudou

Quote from: Targhan on 18:46, 18 February 24Thanks. I still need to be convinced about the sound quality. If you have wav of before/after samples, I would like to hear that.
Also, I notice in the command line that you can have 3-channel output. Is there a real benefit to this?

depend on the target. For inspiration, one channel is enough then you can build a better instrument, for voices, 3 channels give strong results regarding the size

here is an example of replay in situation : music playing, then you can press 1,2,3,4,5,6,7,8,9,0 (not from keypad) and listen some SF2 sounds


My pronouns are RASM and ACE

Targhan

Well, I'm sure this could be tweaked and improved, but to be honest, I think it really sounds bad :). I wouldn't want that in a SF2 game, it makes absolutely no sense. It sounds like the little dinosaurs in Puzzle Bobble spewing gibberish :).

I can still be convinced of course. Because even if it seems technically simple to play such "samples", it would still require a specific implementation in AT (a specific instrument view, export tweaks, specific code for SFX players, etc.). Quite a lot of work. I wouldn't do that if the result isn't worth it.
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

roudoudou

New release v1.3 with WAV Float-32 PCM support

https://github.com/EdouardBERGE/wav2ay/releases/tag/v1.3

And a few fixes which were already in previous daily build
My pronouns are RASM and ACE

SpDizzy

Thanks so much @roudoudou for this update. Really enjoying the tool, very helpfull for someone completely null with music like me


Powered by SMFPacks Menu Editor Mod