Package com.echonest.api.v4

Examples of com.echonest.api.v4.Segment


        BasicPlaylistParams params = new BasicPlaylistParams();
        params.addArtist("Weezer");
        params.setType(BasicPlaylistParams.PlaylistType.ARTIST_RADIO);
        params.setResults(10);
        Playlist playlist = en.createBasicPlaylist(params);

        for (Song song : playlist.getSongs()) {
            System.out.println(song.toString());
        }
    }
View Full Code Here


public class ChristmasPlaylist {
   
        public static void main(String[] args) throws EchoNestException {
        EchoNestAPI en = new EchoNestAPI();

        PlaylistParams params = new PlaylistParams();
        params.setType(PlaylistParams.PlaylistType.ARTIST_RADIO);
        params.addArtist("Bing Crosby");
        params.addSongType(SongType.christmas, Song.SongTypeFlag.True);
        Playlist playlist = en.createStaticPlaylist(params);
        for (Song song : playlist.getSongs()) {
            System.out.println(song.getTitle() + " by " + song.getArtistName());
        }
    }
View Full Code Here

    public static void main(String[] args) throws EchoNestException {
        EchoNestAPI en = new EchoNestAPI();

        // play fast songs by metal bands

        PlaylistParams params = new PlaylistParams();
        params.setType(PlaylistParams.PlaylistType.GENRE_RADIO);
        params.addGenre("metal");
        params.setMinTempo(150);
        params.setResults(10);
        params.includeAudioSummary();
        Playlist playlist = en.createStaticPlaylist(params);

        for (Song song : playlist.getSongs()) {
            System.out.println(song.toString());
        }
View Full Code Here

*/
public class RosettaPlaylistExample {
   
    public static void main(String[] args) throws EchoNestException {
        EchoNestAPI en = new EchoNestAPI();
        PlaylistParams params = new PlaylistParams();
        params.addIDSpace("spotify-WW");
        params.setType(PlaylistParams.PlaylistType.GENRE_RADIO);
        params.addGenre("dance pop");
        params.includeTracks();
        params.setLimit(true);
       
        Playlist playlist = en.createStaticPlaylist(params);

        for (Song song : playlist.getSongs()) {
            Track track = song.getTrack("spotify-WW");
View Full Code Here

        }

        System.out.println(" =========  reviews ======== ");
        List<Review> reviews = artist.getReviews();
        for (int i = 0; i < reviews.size(); i++) {
            Review review = reviews.get(i);
            review.dump();
        }

        System.out.println(" =========  videos ======== ");
        List<Video> videos = artist.getVideos();
        for (int i = 0; i < videos.size(); i++) {
View Full Code Here

*/
public class DynamicPlaylistExample {

    public static void main(String[] args) throws EchoNestException, IOException {
        EchoNestAPI en = new EchoNestAPI();
        Song lastSong = null;
        en.setTraceSends(false);

        DynamicPlaylistParams params = new DynamicPlaylistParams();
        params.setType(PlaylistParams.PlaylistType.GENRE_RADIO);
        params.addGenre("dance pop");
        params.setMinEnergy(.6f);
        params.setMinDanceability(.6f);
        params.includeAudioSummary();
        DynamicPlaylistSession session = en.createDynamicPlaylist(params);


        boolean done = false;
        while (!done) {
            String keys = "nsfd+-";

            System.out.println();
            System.out.print("(n)ext (s)kip (f)av (d)one (+)faster (-)slower ->");

            int cv;
            do {
                cv = System.in.read();
            } while (keys.indexOf(cv) < 0);

            char c = (char) cv;

            // System.out.println("c " + c + " " + cv);

            if (c == 'd') {
                done = true;
            }

            if (c == 'f') {
                session.feedback(DynamicPlaylistSession.FeedbackType.favorite_song, "last");
            }

            if (c == 's') {
                session.feedback(DynamicPlaylistSession.FeedbackType.skip_song, "last");
            }

            if (c == 'n') {
                Playlist playlist = session.next();

                for (Song song : playlist.getSongs()) {
                    System.out.println(song.getTitle());
                    System.out.println(song.getArtistName());
                    System.out.printf("Dance: %f\n", song.getDanceability());
                    System.out.printf("Energy: %f\n", song.getEnergy());
                    System.out.printf("Tempo: %f\n", song.getTempo());
                    lastSong = song;
                }
            }

            if (c == '+') {
                if (lastSong != null) {
                    DynamicPlaylistSteerParams steerParams = new DynamicPlaylistSteerParams();
                    steerParams.addTargetValue(DynamicPlaylistSteerParams.SteeringParameter.tempo, (float) lastSong.getTempo() * 1.2f);
                    System.out.println("steer " + steerParams);
                    session.steer(steerParams);
                }
            }

            if (c == '-') {
                if (lastSong != null) {
                    DynamicPlaylistSteerParams steerParams = new DynamicPlaylistSteerParams();
                    steerParams.addTargetValue(DynamicPlaylistSteerParams.SteeringParameter.tempo, (float) lastSong.getTempo() * .8f);
                    System.out.println("steer " + steerParams);

                    session.steer(steerParams);
                }
            }
View Full Code Here

        System.out.printf("   A loc : %s\n", song.getArtistLocation());
    }

    public void searchSongsByArtist(String artist, int results)
            throws EchoNestException {
        SongParams p = new SongParams();
        p.setArtist(artist);
        p.includeAudioSummary();
        p.includeArtistHotttnesss();
        p.includeSongHotttnesss();
        p.includeArtistFamiliarity();
        p.includeArtistLocation();
        p.sortBy("song_hotttnesss", false);


        List<Song> songs = en.searchSongs(p);
        for (Song song : songs) {
            dumpSong(song);
View Full Code Here

        }
    }

    public Double getTempo(String artistName, String title)
            throws EchoNestException {
        SongParams p = new SongParams();
        p.setArtist(artistName);
        p.setTitle(title);
        p.setResults(1);
        p.includeAudioSummary();
        List<Song> songs = en.searchSongs(p);
        if (songs.size() > 0) {
            double tempo = songs.get(0).getTempo();
            return Double.valueOf(tempo);
        } else {
View Full Code Here

        en.showStats();
    }

    public void searchSongsWithIDSpace(String artist, int results)
            throws EchoNestException {
        SongParams p = new SongParams();
        p.setArtist(artist);
        p.setLimitAny();
        p.includeTracks();
        p.addIDSpace("rdio-US");
        p.addIDSpace("spotify-WW");

        List<Song> songs = en.searchSongs(p);
        for (Song song : songs) {
            System.out.printf("%s\n", song.getTitle());
            System.out.printf("   artist: %s\n", song.getArtistName());
View Full Code Here

public class TopHotttestSongs {

    public static void main(String[] args) throws EchoNestException {
        EchoNestAPI en = new EchoNestAPI();

        SongParams p = new SongParams();
        p.setResults(100);
        p.sortBy("song_hotttnesss", false);
        List<Song> songs = en.searchSongs(p);


        String lastTitle = "";
        for (Song song : songs) {
View Full Code Here

TOP

Related Classes of com.echonest.api.v4.Segment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.