Jump to content
IGNORED

FujiConvert 0.1


Xuel

Recommended Posts

 

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.

Avengers pcm44 mono 44270Hz ide pal.rar

London Boys - I'm Gonna Give My Heart pcm44 mono 44270Hz ide pal.rar

Edited by Poison
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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

post-18200-0-14256200-1527760022.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :)

post-18200-0-70480100-1527772406_thumb.jpg

Edited by Poison
  • Like 1
Link to comment
Share on other sites

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" :)

  • Like 1
Link to comment
Share on other sites

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. :)

  • Like 2
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
  • Like 2
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

  • Like 3
Link to comment
Share on other sites

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.mcmaster.ca/~nicola/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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...