Creating media_bundle entities programatically I am still trying to wrap my head around some of the D8 things.  Working with some media bundles like media_audio_bundle and need to write some migration scripts. I have spent couple of days now researching and trying everything but nothing seems to work. 

Its like Drupal wall all over again. 

This is the closest I came:

$audio = \Drupal::entityTypeManager()
          -&gt;getStorage('media_bundle')
          -&gt;create(array(
            'type' =&gt; 'media', 
            'bundle' =&gt; 'audio', 
            'title' =&gt; 'Another Audio', 
            'field_audio_file' =&gt; 11
          ));


It seems to create some sort of media object but does not save it. 

If somebody can help, would be much appreciated.
use Drupal\media_entity\Entity\Media;

$image_data = file_get_contents("URL OF FILE");
$file_image = file_save_data($image_data, 'public://FILENAME', FILE_EXISTS_REPLACE);
$media_image = Media::create([
  'bundle' =&gt; 'image',(YOUR BUNDLE)
  'name' =&gt; "FILENAME",
  'field_image' =&gt; [
    'target_id' =&gt; $file_image-&gt;id(),
  ],
]);
$media_image-&gt;save();


Try this one, maybe this will help.