Jump to content

Photo

FujiConvert 0.1


165 replies to this topic

#51 Poison OFFLINE  

Poison

    Moonsweeper

  • 341 posts
  • Location:Czech Republic

Posted Thu May 31, 2018 3:07 AM

 

Hmm, OK, then maybe you're running into the problem where the cluster table overwrites the hi/lo PCM4+4 tables. Can you try playing a shorter file, like around 5MB?

 

this play OK, but its only 20 seconds lenght and size 1,2MB

 

And one more thing, when I run pdm player from side loader, than loader run, but I can not choose file to play. Automatically is taken first file a starting to build file and than play. its bug, feature or problem on my atari ?

 

and new London Boys (cutted) play good too.

Attached Files


Edited by Poison, Thu May 31, 2018 3:39 AM.


#52 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 13,683 posts
  • Location:United Kingdom

Posted Thu May 31, 2018 3:43 AM

And one more thing, when I run pdm player from side loader, than loader run, but I can not choose file to play. Automatically is taken first file a starting to build file and than play. its bug, feature or problem on my atari ?


Sorry if you already answered the question the last time I asked it: but what loader are you actually running? I seem to remember some versions of the original SIDE loader left an enter key pending which would be issued to any application you started.

General point: I think we should decide on some file header format for these PDM files so that the loader can discern whether the stream is stereo or mono, what the bitrate is, the interleave, etc. Could include metadata as well. Plain text or binary would both work, as long as the header size is multiples of 512 bytes.

#53 Poison OFFLINE  

Poison

    Moonsweeper

  • 341 posts
  • Location:Czech Republic

Posted Thu May 31, 2018 3:47 AM

Sorry if you already answered the question the last time I asked it: but what loader are you actually running? I seem to remember some versions of the original SIDE loader left an enter key pending which would be issued to any application you started.

General point: I think we should decide on some file header format for these PDM files so that the loader can discern whether the stream is stereo or mono, what the bitrate is, the interleave, etc. Could include metadata as well. Plain text or binary would both work, as long as the header size is multiples of 512 bytes.

 

this player

Attached Thumbnails

  • player.png


#54 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 13,683 posts
  • Location:United Kingdom

Posted Thu May 31, 2018 4:23 AM

Not the player: the SIDE loader you're using to LAUNCH the player, since you complain of phantom keystrokes appearing when the player starts up.

#55 Poison OFFLINE  

Poison

    Moonsweeper

  • 341 posts
  • Location:Czech Republic

Posted Thu May 31, 2018 4:36 AM

Not the player: the SIDE loader you're using to LAUNCH the player, since you complain of phantom keystrokes appearing when the player starts up.

 

do you mean this ?

Attached Thumbnails

  • 20180531_123437.jpg

Edited by Poison, Thu May 31, 2018 5:05 AM.


#56 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 13,683 posts
  • Location:United Kingdom

Posted Thu May 31, 2018 5:52 AM

Yes: my suspicions were correct. ;)

You can grab a newer loader from my website pending release of the latest version.

#57 ivop OFFLINE  

ivop

    Dragonstomper

  • 662 posts
  • Location:The Netherlands

Posted Thu May 31, 2018 7:05 AM

Looks like both Chromium (sinc_resampler.cc) and WebKit (SincResampler.cc) use sinc resamplers which are "brick-wall" filters. So we don't need to apply another low-pass filter before resampling, right?

 

In theory, it's an ideal filter, but in practice I don't think it is. Also, I believe the cut-off frequency is exactly f/2. I would like to have its "knee" a little lower, with a sharp cut-off of 24dB/octave. But perhaps you're right and it's overkill to pre-filter.



#58 Poison OFFLINE  

Poison

    Moonsweeper

  • 341 posts
  • Location:Czech Republic

Posted Thu May 31, 2018 7:14 AM

Yes: my suspicions were correct. ;)

You can grab a newer loader from my website pending release of the latest version.

What i did wrong ? Iam not able to flash it :) i have your atr in sdrive drive 1, side 2 in cart slot spartados is ON and PBI device too.

 

EDIT - SOLVED :)

Attached Thumbnails

  • 20180531_151209.jpg

Edited by Poison, Thu May 31, 2018 7:29 AM.


#59 Stephen OFFLINE  

Stephen

    Quadrunner

  • 7,096 posts
  • A8 Gear Head
  • Location:No longer in Crakron, Ohio

Posted Thu May 31, 2018 7:20 AM

General point: I think we should decide on some file header format for these PDM files so that the loader can discern whether the stream is stereo or mono, what the bitrate is, the interleave, etc. Could include metadata as well. Plain text or binary would both work, as long as the header size is multiples of 512 bytes.

Love the idea of information in a header.  On a somewhat related note, would it be possible to add a "playlist" capability to your player?  I know there will be gaps in between songs as the map files are built, but it would be cool to be able to queue up entire albums, or mixes.  I'm thinking Winamp on our little Ataris.  We already have the one "visualizer" :)



#60 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 13,683 posts
  • Location:United Kingdom

Posted Thu May 31, 2018 7:51 AM

I like these ideas Stephen. I was already thinking that if there were metadata tags in the header, we could categorise files based on artist, genre, etc. The Google-like search facility that I left in there could even be augmented to search for metadata tags... the possibilities are endless. :)

#61 Poison OFFLINE  

Poison

    Moonsweeper

  • 341 posts
  • Location:Czech Republic

Posted Thu May 31, 2018 7:55 AM

interesting, and pdm player can look like winamp for atari :) with many features like random play, stop, pause, next ;-)



#62 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 13,683 posts
  • Location:United Kingdom

Posted Thu May 31, 2018 8:23 AM

Yeah: there's room to scan the keyboard and we can skip ahead and reverse just by scanning the cluster table. DMA is off during playback but we can display a jog bar of some kind during skips.

#63 Xuel OFFLINE  

Xuel

    Dragonstomper

  • Topic Starter
  • 714 posts
  • Location:US

Posted Thu May 31, 2018 12:32 PM

General point: I think we should decide on some file header format for these PDM files so that the loader can discern whether the stream is stereo or mono, what the bitrate is, the interleave, etc. Could include metadata as well. Plain text or binary would both work, as long as the header size is multiples of 512 bytes.

 

How about ID3v2? Then common tag editors could be used to modify the Artist/Title etc. metadata. We could invent some A8-specific tags to store playback info. We could even approach it like ASAP and SID formats by embedding a callable player routine as a tag. We wouldn't be able to guarantee multiples of 512 bytes, but it shouldn't be too hard to initialize the player so that it starts mid sector, no? Just need to compute the address to jump to in the unrolled player code.



#64 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 13,683 posts
  • Location:United Kingdom

Posted Thu May 31, 2018 12:50 PM

I'd have to sit and think about the sector boundary matter, since the first half of the sector read is spent populating the buffer which is read immediately after the read command for the subsequent sector is issued. The player isn't unrolled, either: it was enough to unroll the code which plays the first half dozen bytes from the buffer so that the next sector read can be issued at the same time.

 

Here's the player code, which might better illustrate what I'm talking about. I probably will end up unrolling the second half, since the loop is actually a couple of cycles over:

	
	.proc PlayPDM
	mwa #SectorList ptr1
	ldy SectorsPerCluster
	dey
	sty SectorsPerClusterMask
	
	lda #0
	sta nmien
	sei
	sta DMACTL
	sta AUDCTL

	jsr GetClusterLBA	; get sector number of first cluster
	jsr SetUpSectorRead	; issue read command and wait for DRQ
	ldy #0
	lda #1
	sta SectorOff
	sty SectorOff+1
	sty SectorOff+2
	sty SectorOff+3
	
;	mva #$FE PORTB	; disable OS

	mva #$0F COLPM0	; colours
	mva #$FF GRAFP0

	mva #3 SKCTL	; init POKEY
	sta wsync
	sta wsync
   
FAST1 equ 1<<6	; 1.79Mhz for channel 1
    
FAST3 equ 1<<5	; 1.79Mhz for channel 3

HI13 equ 1<<2   ; HiPass 1+3

KHZ15 equ 1<<0   ; 15Khz
	mva #[FAST1|FAST3|HI13] AUDCTL
;	mva #[HI13|KHZ15] AUDCTL
	lda #0
	ldx #7
	sta:rpl AUDF1,x-

	mva #5 AUDF3 ; Set up 1/16 dutycycle HiPass on 1+3
	mva #3 AUDF1
	sta STIMER
	sta AUDF3

	ldy #0
	jmp GetPDMData	; start playing and filling the buffer
	
;	nop	; 2
;	bit 0	; 3
;	bit $0100	; 4

;	Main Player loop

	ldy #0	; 2
	sty EOFFlag
	
PlayerLoop
	clc		; 2

;	issue next sector read and play first half of buffer

; -------------------------------------

	ldx buffer	; 4
	mva hi,x AUDC3	; 8
	mva lo,x AUDC1	; 8 (20)

	lda (ptr1),y		; 5 (no page boundary crossing)
	adc SectorOff	; 3
	sta IDE_SNUM		; 4 (32)

	iny	; 2
	bit 0	; 3 (37)

; -------------------------------------

	ldx buffer+1	; 4
	mva hi,x AUDC3	; 8
	mva lo,x AUDC1	; 8 (20)

	lda (ptr1),y	; 5
	adc #0	; 2
	sta IDE_CYLL	; 4 (31)

	iny	; 2
	bit $0100	; 4 (37)

; -------------------------------------

	ldx buffer+2	; 4
	mva hi,x AUDC3	; 8
	mva lo,x AUDC1	; 8 (20)

	lda (ptr1),y	; 5
	sta EOFFlag	; 4
	adc #0	; 2
	sta IDE_CYLH	; 4 (31)

	nop
;	bit 0	; 3
;	bit 0	; 3 (37)
;	iny ; 2
;	bit $0100	; 4 (37)

; -------------------------------------

	ldx buffer+3	; 4
	mva hi,x AUDC3	; 8
	mva lo,x AUDC1	; 8 (20)

	lda #$E0		; 2
	sta IDE_HEAD	; 4
	lda #$01		; 2
	sta IDE_SCNT	; 4 (32)
	lda #$20		; 2
	sta IDE_STAT	; 4

;	nop		; 2
;	bit 0	; 3 (37)

; -------------------------------------

	ldx buffer+4	; 4
	mva hi,x AUDC3	; 8
	mva lo,x AUDC1	; 8 (20)

	inc SectorOff	; 5 - bump sector for next time 
	lda SectorOff	; 3
	and SectorsPerClusterMask	; 3
	sta SectorOff	; 3
	bne SameCluster	; 3	(37)
	
; -------------------------------------
; Next cluster, so bump pointer

	ldx buffer+5	; 4
	mva hi,x AUDC3	; 8
	mva lo,x AUDC1	; 8 (20)

	lda ptr1	; 3
	clc	; 2
	adc #4	; 2
	sta ptr1	; 3	(30)

	bit 0	; 3
	bit $0100	; 4 (37)

; -------------------------------------

	ldx buffer+6	; 4
	mva hi,x AUDC3	; 8
	mva lo,x AUDC1	; 8 (20)

	lda ptr1+1	; 3
	adc #0	; 2
	sta ptr1+1	; 3	(28)

;	bit 0	; 3
;	bit 0	; 3
;	bit 0	; 3
	bit $0100	; 4
	ldy #7	; 2
	jmp Loop1	; 3 (37)

; -------------------------------------
	
SameCluster

; 	play the rest of the buffer

Loop1	; keep on one page
	ldx buffer,y	; 4
	mva hi,x AUDC3	; 8
	mva lo,x AUDC1	; 8 (20)

	stx hposp0	; 4
	bit $100	; 4
	bit $100	; 4

	iny	; 2	(17)
	bne Loop1	; 3 (assuming same page)
	

; -------------------------------------

;	Now play the first half of the IDE data while filling the buffer with the second half
;	Note: data is interleaved, with the upper half of the sector in the high order bytes

GetPDMData
;	lda IDE_STAT
;	cmp #$58
;	beq Loop2
;	brk
;	ldy #0	; 2

Loop2
	ldx IDE_DATA	; 4 - grab a byte from the drive
	mva hi,x AUDC3	; 8
	mva lo,x AUDC1	; 8 (20)

	lda IDE_DATA	; 4
	sta Buffer,y	; 5
	iny	; 2
	nop	; 2
	stx hposp0	; 4 (37)

	ldx IDE_DATA	; 4 - grab a byte from the drive
	mva hi,x AUDC3	; 8
	mva lo,x AUDC1	; 8 (20)

	lda IDE_DATA	; 4
	sta Buffer,y	; 5
	bit 0	; 3
	iny	; 2
	bne Loop2	; 3 (37)

	inc EOFFlag
	beq Done
	
	jmp PlayerLoop
Done	
	jmp Start
	
	.endp


Edited by flashjazzcat, Thu May 31, 2018 12:59 PM.


#65 Xuel OFFLINE  

Xuel

    Dragonstomper

  • Topic Starter
  • 714 posts
  • Location:US

Posted Thu May 31, 2018 1:00 PM

I'd have to sit and think about the sector boundary matter, since the first half of the sector read is spent populating the buffer which is read immediately after the read command for the subsequent sector is issued. The player isn't unrolled, either: it was enough to unroll the code which plays the first half dozen bytes from the buffer so that the next sector read can be issued at the same time.


In a pinch we could just put 512 bytes of silence at the start of the audio portion. Then you could just seek to the next sector after you're done reading the ID3v2 tags. 512 bytes is only about 0.01 seconds at 44kHz so shouldn't be noticeable.

#66 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 13,683 posts
  • Location:United Kingdom

Posted Thu May 31, 2018 1:02 PM

Yeah: that's an inventive solution. :)



#67 Xuel OFFLINE  

Xuel

    Dragonstomper

  • Topic Starter
  • 714 posts
  • Location:US

Posted Thu May 31, 2018 1:05 PM

Ugh, never mind. I just realized that a ID3v2 container with an odd number of bytes would throw everything off.

EDIT: And not just an odd number of bytes, but anything other than an exact multiple of 512 bytes. Duh. :dunce:


Edited by Xuel, Thu May 31, 2018 1:07 PM.


#68 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 13,683 posts
  • Location:United Kingdom

Posted Thu May 31, 2018 1:13 PM

Yeah: same here. I didn't think it through too well either. :)



#69 Fox-1 / mnx OFFLINE  

Fox-1 / mnx

    Stargunner

  • 1,556 posts
  • What is your Alternate Reality?
  • Location:NL, Earth 2.0

Posted Thu May 31, 2018 1:42 PM

ID3V2 Is way overkill.  The fixed and padded 128 bytes length of ID3V1 makes it much more suitable for smaller systems and is (should be) backwards compatible.



#70 foft ONLINE  

foft

    Dragonstomper

  • 729 posts
  • Location:Nyon, Switzerland

Posted Thu May 31, 2018 2:27 PM

Now what I'm wondering is if an mp3 to pdm converter could be done live in the Ultimate Cart, while reading from the SD card.

(edit: http://www.ece.mcmas...cola/mpeg.html)

Edited by foft, Thu May 31, 2018 2:30 PM.


#71 Xuel OFFLINE  

Xuel

    Dragonstomper

  • Topic Starter
  • 714 posts
  • Location:US

Posted Thu May 31, 2018 10:29 PM

CharlieChaplin sent me some questions over PM he gave me permission to share the answers here as well:
 
Q: Does it require WAV files or are MP3's also okay for conversion ? It seems to accept and convert MP3, not sure if the converted file will later work on the A8 then (since I did not have time to test it on the real A8 yet)... to make sure I can use it on the A8, I always choose "atarimax" and max. "1MB", because atarimax 1MB carts do normally work with my Ultimate Cart...
 
A: FujiConvert supports any format that is supported by your browser's WebAudio implementation. For example, Firefox's list is here, namely WebM, Ogg Theora Vorbis, Ogg Opus, Ogg FLAC, MP4, MP4 FLAC, MP3, WAVE, PCM, FLAC. If the converted file sounds OK in Altirra then it should work on hardware.
 
Q: What are the options "Gain", "Offset" and "Duration" for ? Currently I only type in the title/tag and then convert the MP3, while leaving these options untouched... Can you get a better quality when changing something there (Gain, Offset) or shorten the conversion by cutting off a part of the WAV/MP3 (Offset, Duration)...?!?
 
A: Apologies for the spartan UI.
Gain is a volume control. 1=no change, 1.5=150%, 2=double, 0.5=half, etc. Bump this up if you are converting a quiet song and leave it close to 1 for a loud song. In Altirra, I suggest turning on System -> Configure System... -> Audio -> Audio Monitor (I bind this to a hotkey) to see if the resulting sound is clipping too much. Eventually I'd like to add tools to investigate and tune the dynamic range in the converter itself.
Offset is a number of seconds to skip at the beginning of the song.
Duration is the number of seconds to convert. -1=full song.
 
Q: Errm, you named the converter "Fuji Convert", how about a more fitting or more obvious name, like e.g. PDM-Convert or PDM 4+4 Convert ? (Just a silly thought...)
 
A: FujiConvert already supports more playback methods than PDM (what I call PCM4+4) and I have plans to support other things. :)
 
Q: Think I did something wrong, when converting my MP3 sounds into PCM 4+4, because they play fine for some seconds and then you see only garbage and hear trashy loud noise. I tested my conversions with Altirra 2.9x at first and when I noticed the noise, I thought this is because I am using an older version of Altirra... But today I also tested all my atarimax 1MB conversions with the Ultimate Cart. on a real A8 - and there it is exactly the same: Approx. 10-13 seconds of the music play fine, then there are approx. 15-17 seconds garbage + noise.
 
A: I did not include any checks for the end of the song in the player code. Therefore it just continues incrementing the bank numbers. Eventually the bank will wrap around from 255 to 0 (or 65535 to 0 for The!Cart). Depending on how many bits of the bank that the cartridge actually pays attention to, it may wrap around at an earlier power of two or it may enter a mode of the cartridge where the banking window is disabled completely. Also, the player code lives in either bank 0 or the last bank of the cartridge, whichever one is active upon power up. All this means that the free-running player will eventually hit non-audio data which will result in horrible noises. :-o I should be able to insert a proper check for the end of the audio and wrap around to the beginning or go back to the splash screen.



#72 Xuel OFFLINE  

Xuel

    Dragonstomper

  • Topic Starter
  • 714 posts
  • Location:US

Posted Fri Jun 1, 2018 10:11 AM

Now what I'm wondering is if an mp3 to pdm converter could be done live in the Ultimate Cart, while reading from the SD card.

(edit: http://www.ece.mcmas...cola/mpeg.html)

 

That's pretty cool. I wonder how much of the Ultimate Cart's FPGA is available for extra functionality or if you'd have to replace the ROM emulation to make room for this. Looks like the Ultimate Cart uses an 8K logic element Altera FPGA. The MAC_MP3 decoder uses ~600flops/4000 logic elements so it seems like it should fit?



#73 Mathy OFFLINE  

Mathy

    River Patroller

  • 2,658 posts
  • Location:Heerlen, NL

Posted Fri Jun 1, 2018 5:41 PM

Hello guys

 

[Think Mathy and several other Atarians also need a solution/player for the Ultimate Cart. ...]

 

I really do.   :grin:

 

Just when the fun starts, 1MB is over.  

 

And it would be nice if the noise could be killed.

 

After that "Ennio Morricone" is no problem.

 

Sincerely

 

Mathy



#74 Stephen OFFLINE  

Stephen

    Quadrunner

  • 7,096 posts
  • A8 Gear Head
  • Location:No longer in Crakron, Ohio

Posted Fri Jun 1, 2018 6:04 PM

Hello guys

 

 

I really do.   :grin:

 

Just when the fun starts, 1MB is over.  

 

And it would be nice if the noise could be killed.

 

After that "Ennio Morricone" is no problem.

 

Sincerely

 

Mathy

What noise are you referring to?  Can you post a video?  The conversions (PDM4+4) I have done here are rather noise free.



#75 Mathy OFFLINE  

Mathy

    River Patroller

  • 2,658 posts
  • Location:Heerlen, NL

Posted Fri Jun 1, 2018 6:12 PM

Hello Stephen

 

The noise at the end.  If I'm not mistaken CharlieChaplin mentioned it to Xuel via PM and Xuel responded in posting number 71 (last question and answer).

 

Sincerely

 

Mathy






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users