convert WAV/MP3 to PSG melody

Page 3/5
1 | 2 | | 4 | 5

By Leo

Paragon (1236)

Leo's picture

20-08-2009, 13:30

it possible to do 3*16*96 , but it is less accurate :

you can look for freq1 like minimize ( f(vol1,freq1,time, phase1) - sample(time) ) ^2 that gives f1, then
minimize ( f(vol2,freq2,time, phase2) - sample(time)-f1(time) ) ^2 then the same for f3.

you can even do a little optimization like assuming freq3>freq2>freq1 so the frequency is searched not
on 96 possibilities but on 96 for f1 and (96-f1) for f2 and (96-f2) for f3.

By Leo

Paragon (1236)

Leo's picture

20-08-2009, 13:31

guess what .... i have ! .. i never imagined u could propose a variant that quick ! thanks !

By Leo

Paragon (1236)

Leo's picture

20-08-2009, 14:30

after some trials , it seems to converge always to minimal volume as if all other solutions were worse , i tried adding phase and dealing only with freq1 and 2 to make it lighter , but still converges to minmial volume and frequency is really meaning less since it is converges for f1 and f2 to the same freq.

i realize also we dont control the relative phase of the 3 voices, i guess they are in phase since they must be produced by the same counter mechnism inside psg , but we still have a 180degree uncertainty.

By Leo

Paragon (1236)

Leo's picture

12-09-2009, 13:41

a pair of examples of replayer for msx ,
each rom file a song+replayer that starts automatically:

http://iledefra01.free.fr/msx/WIND.ROM
http://iledefra01.free.fr/msx/POC2.ROM

B-)

By PingPong

Prophet (3898)

PingPong's picture

12-09-2009, 14:03

a pair of examples of replayer for msx ,
each rom file a song+replayer that starts automatically:

http://iledefra01.free.fr/msx/WIND.ROM
http://iledefra01.free.fr/msx/POC2.ROM

B-)
Urg! Melody is the same of that played by a child pressing random keys at random duration in a piano. :(:(:(:(;)

By Leo

Paragon (1236)

Leo's picture

12-09-2009, 14:40

guess what .... i have taken the 2 more hearable song of my stac of trials ....

Crying

By ARTRAG

Enlighted (6845)

ARTRAG's picture

12-09-2009, 17:51

they sound very nice actually
what is the matlab code you used for getting them?

By Leo

Paragon (1236)

Leo's picture

12-09-2009, 18:11

Thanks for the feedback , i am not very musician ( that is why i am searching a programa that do it for me )
so i may find ok something that is ugly for everyone else !!!
...
I have used the code i posted in first place .
What i do to improve : is to select a very clean source , i go to youtube and i search for any song with flute or ocarina or pan flute or other simple melody . Then i try to "clean it" with low pass filter and high pass filter , usually i try to use only the 150Hz-3khz band since all what is above 3khz is more or less cymbals and all what is below 150Hz are very loud bass which tends to asphixiate the main theme , at least this what happens with my prog .
I also tweak the variable that integrates the melody and also the parameter that defines the the size of each audio segment to analyse . Usually i try to use only 5 notes per seconds and compare it to 10 notes per seconds, using only 5 notes per sec makes smaller data in rom .
Also 5 or 10 notes per seonds cn be easily replayed in ether 50Hz or 60z games.
For integration a 1/3 vs 2/3 ratio is good in general sometimes for fast changing musics 1/4 vs 3/4 is better .
...
@pingpong : i have a better one : sounds like a monkey going down the stairs ! Crying
Just kidding ... in fact what also males them sounds unnatural is that the beat is
somehow fixed to 5/sec , as i was just explaining.

By Leo

Paragon (1236)

Leo's picture

12-09-2009, 18:13

Here is the code for the roms with replayer , in fact very basic :

org 4000h

DB "AB"
DW INIT
DEFS 12

INIT:
ld a,7
ld e,56
call 0093h
ld hl,MUS_DAT
dec hl
ld a,0
ld (0c000h),a
ei

MUS_LOOP:
halt
ld a,(0c000h)
inc a
ld (0c000h),a
cp 5
jr z,cont_mus56
jp MUS_LOOP
cont_mus56:
ld a,0
ld (0c000h),a
inc hl
ld a,(hl)
dec hl
cp 255
jr nz,cont_mus57
ld hl,MUS_DAT
dec hl
jp MUS_LOOP
cont_mus57:
inc hl
ld e,(hl)
ld a,8
call 0093h

inc hl
ld e,(hl)
ld a,9
call 0093h

inc hl
ld e,(hl)
ld a,10
call 0093h

;freqs
inc hl
ld e,(hl)
ld a,0
call 0093h

inc hl
ld e,(hl)
ld a,1
call 0093h

inc hl
ld e,(hl)
ld a,2
call 0093h

inc hl
ld e,(hl)
ld a,3
call 0093h

inc hl
ld e,(hl)
ld a,4
call 0093h

inc hl
ld e,(hl)
ld a,5
call 0093h

jp MUS_LOOP

MUS_DAT:
*INCLUDE out_pin2.txt
DB 255,255

By MäSäXi

Paragon (1884)

MäSäXi's picture

12-09-2009, 20:36

I liked that WIND song. Smile That is nice enough to be added into some game! Smile Surely gives strange atmosphere! Smile And that was a praise for your song conversion. Smile

Shame that my Rock-A-Billies were too raw to your converter.... hhmmmm... that must mean that Rock-A-Billy is too raw thing to be played on MSX!! Tongue Tongue Shame indeed......

But I still would like to hear how strange and horrible my tracks sounded, Leo. Smile I don´t care if they are "unhearable".

Page 3/5
1 | 2 | | 4 | 5