Package com.echonest.api.v4

Examples of com.echonest.api.v4.Segment


    }

    public void randomWalk(String seedName, int count) throws EchoNestException {
        List<Artist> artists = en.searchArtists(seedName);
        if (artists.size() > 0) {
            Artist seed = artists.get(0);
            for (int i = 0; i < count; i++) {
                dumpArtist(seed);
                List<Artist> sims = seed.getSimilar(10);
                if (sims.size() > 0) {
                    Collections.shuffle(sims);
                    seed = sims.get(0);
                } else {
                    break;
View Full Code Here


        EchoNestAPI echoNest = new EchoNestAPI();
        echoNest.setTraceSends(true);
        List<Artist> artists = echoNest.searchArtists("Weezer");

        if (artists.size() > 0) {
            Artist weezer = artists.get(0);
            System.out.println("Similar artists for " + weezer.getName());
            for (Artist simArtist : weezer.getSimilar(10)) {
                System.out.println("   " + simArtist.getName());
            }
        }
    }
View Full Code Here

        }
    }

    public void searchForFastestSongsByArtist(String artist, int results)
            throws EchoNestException {
        ArtistParams ap = new ArtistParams();
        ap.addName(artist);
        List<Artist> artists = en.searchArtists(ap);
        if (artists.size() > 0) {
            Params p = new Params();
            p.add("artist_id", artists.get(0).getID());
            p.add("bucket", "audio_summary");
View Full Code Here

public class BasicPlaylistExample {

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

        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


        System.out.println(" =========  bios ======== ");
        List<Biography> bios = artist.getBiographies();
        for (int i = 0; i < bios.size(); i++) {
            Biography bio = bios.get(i);
            bio.dump();
        }

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

        }

        System.out.println(" =========  blogs ======== ");
        List<Blog> blogs = artist.getBlogs();
        for (int i = 0; i < blogs.size(); i++) {
            Blog blog = blogs.get(i);
            blog.dump();
        }

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

    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) {
View Full Code Here

        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

                }
            }

            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

* @author plamere
*/
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

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.