Hello,

While waiting for some help to finish the module player. I stumbled
accross a great collection of C64 Sid music. And I found all the tools
needed to make slimserver play them. 

the sid player, sidplay2 takes 100% CPU while converting the sid tune
into wave format for quite some time (up to a minute in what I've seen
on a 2.4Ghz) so if you insist on having gapless audio this is not for
you.

Here's what I did:

- Get and compile libsidplay2 and sidplay2 from (or apt-get,
emerge,...)

http://sidplay2.sourceforge.net/

- copy sidplay2 into Bin/i386-linux and give proper permissions

- Add these lines to strings.txt for the display in Server Settings ->
File Types to work nicely


Code:
--------------------
    
  SID
  EN      SID Music
  ES      SID Music
  FR      SID Music
  
--------------------


- Add this lines to types.conf

Code:
--------------------
    
  sid     sid             audio/prs.sid                   audio
  
--------------------


- Add these lines to convert.conf

Code:
--------------------
    
  sid flc * *
  [sidplay2] -q -O0 -pc -ss -p16 -f44100 -w/tmp/sidwave.wav $FILE$ ; [flac] -cs 
--compression-level-0 --totally-silent --endian little --channel 2 --bps 16 
--sample-rate 44100 --sign signed --delete-input-file /tmp/sidwave.wav -
  
--------------------

I couldn't get sidplay2 to output to stdout. I even tried
-w/dev/stdout so I used a file in the tmp directory that flac deletes
afterward. I don't know if I could use -w%tmp%/sidwave.wav instead so
that would also work under non Linux platforms?

- Add these lines to Slim/Music/Info.pm in the %tagFunctions array

Code:
--------------------
    
  'sid' => {
  'module' => 'Slim::Formats::Sid',
  'loaded' => 0,
  'getTag' => \&Slim::Formats::Sid::getTag,
  },
  
--------------------


- Create a file Slim/Fornats/Sid.pm and give proper permissions

Code:
--------------------
    
  package Slim::Formats::Sid;
  
  # SlimServer Copyright (c) 2001-2004 Sean Adams, Slim Devices Inc.
  # This program is free software; you can redistribute it and/or
  # modify it under the terms of the GNU General Public License,
  # version 2.
  
  # Written by WildCoder (who still don't know perl)
  # to play C64 Sid musics in slimserver
  # Last modification 2005-11-15
  
  use strict;
  
  # Given a file, return a hash of name value pairs,
  # where each name is a tag name.
  sub getTag {
  
  my $file = shift || "";
  
  my $filesize = -s $file;
  
  $::d_formats && msg( "Opening SID information for $file\n");
  
  # Make sure the file exists.
  return undef unless $filesize && -r $file;
  
  $::d_formats && msg( "Reading SID information for $file\n");
  
  my $tags = {};
  
  my $f;
  my $signature;
  
  open $f, "<$file" || return undef;
  
  $::d_formats && msg( "Checking SID header for $file\n");
  
  return undef if read($f, $signature, 4) < 4;
  return undef if ($signature ne 'PSID');
  
  my $chunkpos = 22;
  return undef unless seek($f, $chunkpos, 0);
  
  my $songname;
  my $artist;
  my $album;
  my $year;
  my $filer;
  
  return undef if read($f, $songname, 32) < 32;
  return undef if read($f, $artist, 32) < 32;
  return undef if read($f, $year, 4) < 4;
  return undef if read($f, $filer, 1) < 1;
  return undef if read($f, $album, 27) < 27;
  
  # Settings that sidplay2 uses to convert the sid tune (matches what's in 
convert.conf)
  
  my $endian           = 0; # little-endian
  my $numChannels      = 2; # Stereo.
  my $sampleSize       = 16;
  
  my $samplesPerSecond = 44100;
  my $numSampleFrames  = $samplesPerSecond * ((3 * 60)+30); # Default to 3:30 
minutes like sidplay2 output
  # This tags appears to be the minimum require to get it to work
  
  $tags->{'ENDIAN'}     = $endian;
  $tags->{'FS'}         = $filesize;
  $tags->{'CHANNELS'}   = $numChannels;
  $tags->{'SAMPLESIZE'} = $sampleSize;
  $tags->{'SIZE'}       = $numSampleFrames * $numChannels * $sampleSize / 8;
  $tags->{'OFFSET'}     = 0;
  $tags->{'RATE'}       = $samplesPerSecond;
  $tags->{'BITRATE'}    = $samplesPerSecond * $numChannels * $sampleSize;
  $tags->{'SECS'}       = $numSampleFrames / $samplesPerSecond;
  $tags->{'BLOCKALIGN'} = $numChannels * $sampleSize / 8;
  
  # These tags just make it look nicer
  
  $tags->{'ALBUM'} = $album;
  $tags->{'GENRE'} = "Computer SID Music";
  $tags->{'ARTIST'} = $artist;
  $tags->{'TITLE'} = $songname;
  $tags->{'YEAR'} = $year;
  #$tags->{'TRACKNUM'} = "Doubt we'll ever have tracks unless we can track down 
some musicdiscs";
  
  return $tags;
  }
  
  1;
  
--------------------


- Add your SID files in your music library. If you don't have any you
can grab a ton of them there:
http://www.hvsc.c64.org/ (30,743 SID files!)

- Stop your server, restart it and force a rescan if it doesn't do so
automatically

- Enjoy with great nostaliga, get a good C64 emulator and play some
good old games :-)

That's all folks!

Anybody knows if it's possible to have sub genre in slimserver?

I'd like to do something like

Code:
--------------------
    
  $tags->{'GENRE'} = "Computer Music;SID";     # For SID
  $tags->{'GENRE'} = "Computer Music;Module";  # For Modules
  
--------------------


instead of having two different main genre they would be both under
"Computer Music"

-WildCoder


-- 
WildCoder
------------------------------------------------------------------------
WildCoder's Profile: http://forums.slimdevices.com/member.php?userid=1827
View this thread: http://forums.slimdevices.com/showthread.php?t=18221

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/unix

Reply via email to