Flac to mp3
#!/bin/bash for file in *.flac do echo Converting $file flac123 -q --wav=- "$file" | lame - "$file".mp3 done
11387 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
#!/bin/bash for file in *.flac do echo Converting $file flac123 -q --wav=- "$file" | lame - "$file".mp3 done
#!/usr/bin/env ruby require 'net/http' require 'csv' user = 'nertzy' csv = Net::HTTP.get 'ws.audioscrobbler.com', "/1.0/user/#{user}/topartists.txt" puts CSV::Reader.parse(csv).collect{ |row| row[2] }.join(", ")
package org.jmf.example; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.metal.MetalLookAndFeel; public class ExampleJMF { public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); try { UIManager.setLookAndFeel(new MetalLookAndFeel()); } catch(UnsupportedLookAndFeelException e) { e.printStackTrace(); } new exampleFrame(); } }
package org.jmf.example; import java.awt.Toolkit; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; public class exampleFrame extends JFrame { private static final long serialVersionUID = 1L; public exampleFrame() { super("JMF - Example..."); setSize(400, 300); setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - getWidth())/2, (Toolkit.getDefaultToolkit().getScreenSize().height - getHeight())/2); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); setContentPane(new examplePanel()); setVisible(true); } }
package org.jmf.example; import java.awt.Component; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import javax.media.ControllerEvent; import javax.media.ControllerListener; import javax.media.Manager; import javax.media.NoPlayerException; import javax.media.Player; import javax.media.RealizeCompleteEvent; import javax.swing.JPanel; public class examplePanel extends JPanel implements ActionListener, ControllerListener { private static final long serialVersionUID = 1L; private Component visualComponent; private Player player; public examplePanel() { try { player = Manager.createPlayer(new URL("file:///tmp/a.mpg")); player.addControllerListener(this); player.start(); } catch(NoPlayerException e) { e.printStackTrace(); } catch(MalformedURLException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } } public void paintComponent(Graphics g) { super.paintComponent(g); } public void actionPerformed(ActionEvent e) { } public void controllerUpdate(ControllerEvent c) { if(player == null) return; if(c instanceof RealizeCompleteEvent) { if((visualComponent = player.getVisualComponent()) != null) add(visualComponent); } } }
<?php /********************************************************************************************** www.strydominc.za.net Created by Jurgen Strydom, 19-08-2006, jurgen.strydom@gmail.com Read the readme.txt Version 1.01, 05-09-2006 **********************************************************************************************/ ?> <link href="lastfmbar.css" rel="stylesheet" type="text/css"> <div> <?php //User settings -> needs your attention $user = "Alkine"; //Your username $width = 700; //width of the list //Code you should not worry about $file = "http://ws.audioscrobbler.com/1.0/user/$user/topartists.xml"; $xml = simplexml_load_file("$file"); $big = $xml->artist[0]->playcount; $total = count($xml->artist); $factor = $width /$big; ?> <table width="<?php echo $width ?>" border="0" cellpadding="0" cellspacing="0"> <?php for ($k=0 ; $k<=$total - 1; $k++) { $barlen = round(($xml->artist[$k]->playcount * $factor), 0); ?> <tr> <td width="<?php echo $width ?>" height="10" valign="center"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="<?php echo $barlen ?>" height="10" valign="center" class="lastfmbar"><?php if ($barlen >= (($width + 100) /2)) { echo "<div align=\"right\">", $xml->artist[$k]->playcount, " - <b>", $xml->artist[$k]->name ,"</b></div>"; } if (($barlen < (($width + 100) /2)) && ($barlen >= ($width / 3))) { echo "<div align=\"right\">", $xml->artist[$k]->playcount ," -</div>"; } if ($barlen < ($width / 3)) { echo " "; } ?></td> <td width="<?php echo $width - $barlen ?>" valign="center"><?php if ($barlen >= (($width + 100) /2)) { echo " "; } if (($barlen < (($width + 100) /2)) && ($barlen >= ($width / 3))) { echo "<div align=\"left\"><b> ", $xml->artist[$k]->name ,"</b></div>"; } if ($barlen < ($width / 3)) { echo "<div align=\"left\">", $xml->artist[$k]->playcount, " - <b>", $xml->artist[$k]->name ,"</b></div>"; } ?></td> </tr> </table></td> </tr> <?php } ?> </table> </div> <?php /********************************************************************************************** Changelog: Version 1.01 Fixed a bug that caused the bar sizes to display incorrectly. Version 1 First release. **********************************************************************************************/ ?>
>>> import smidi >>> m = smidi.MidiOutFile('C:\\out.mid') >>> m.header() >>> m.start_of_track() >>> m.update_time(0) >>> m.note_on(note=0x40) # single note >>> m.update_time(192) >>> m.note_off(note=0x40) # stop it after 192 >>> m.update_time(0) >>> m.end_of_track() >>> m.eof() >>> from audio import Sound >>> s = Sound.open('C:\\out.mid') >>> s.play() >>> s.close()
>>> from smidi import play >>> play([(64,192), (32, 192)])
from audio import * f = 'C:\\Nokia\\Sounds\\Digital\\28050.amr' s = Sound.open(f) s.play()
s.play(3) # 3 times s.play(KMdaRepeatForever) # or just use -2 s.stop() # Ok, enough of it